JavaScript doesn't work if xhtml page is served with application/xhtml+xml mime type

RESOLVED DUPLICATE of bug 197586

Status

()

Core
DOM: Core & HTML
--
major
RESOLVED DUPLICATE of bug 197586
14 years ago
14 years ago

People

(Reporter: vassily "vr" ragosin, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

Manipulating DOM from JavaScript on a XHTML page served with
application/xhtml+xml MIME type, as required by XHTML specification, results in
Error: uncaught exception: [Exception... "Object cannot be created in this
context"  code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" ...]
error and javascript code is not executed.

Reproducible: Always
Steps to Reproduce:
1. Create a simple XHTML file, such as:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>DOM bug test</title>
</head>
<body>
<script type="text/javascript">//<![CDATA[
document.write("will Asa test NASA");
//]]></script>
</body>
</html>

2. Serve this file with an application/xhtml+xml MIME type


Actual Results:  
JavaScript is not executed.

Error: uncaught exception: [Exception... "Object cannot be created in this
context"  code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" 
location: "http://localhost.gov/test.xhtml Line: 9"]


Expected Results:  
Page must be shown exactly as with text/html MIME type,
ie the text 

will Asa test NASA

should appear in the browser.

Comment 1

14 years ago
see Bug 197586, Bug 215904 and others.
Yep.  There's no document.write in XML documents.

*** This bug has been marked as a duplicate of 197586 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.