Closed
Bug 178399
Opened 23 years ago
Closed 23 years ago
JavaScript does not work in XHTML
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 111514
People
(Reporter: Christian.Hujer, Assigned: rogerl)
Details
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2b) Gecko/20021016
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2b) Gecko/20021016
I just have found out that JavaScript does not work in XHTML.
I tried the following document (saved with extension ".xhtml"!):
<?xml version="1.0" encoding="iso-8859-1"?>
<!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="de">
<head>
<title>Titel des Dokuments</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=iso-8859-1" />
</head>
<body>
<h1>Überschrift</h1>
<p>
Ein Absatz mit Text.
</p>
<script type="text/javascript"><![CDATA[
x = 10;
document.write(x);
]]></script>
</body>
</html>
The Script is not executed. I tried using comments instead of CDATA-Sections, I
tried different MIME-Types, no matter how hard I tried, it will not execute.
When I use comments and ".html" it works fine.
I tried the following MIME-Types:
- text/javascript
- text/JavaScript
- text/emcascript
- text/ECMAScript
Reproducible: Always
Steps to Reproduce:
1. Get the snipped
2. Save it as anything.xhtml
3. Load it
Actual Results:
Does not display 10. Obviously the JavaScript is not executed.
I verified that this is not just no access on document because inserting
window.alert("bla"); gave no window.
Expected Results:
Display 10 resp. execute the JavaScript
Because I think that XHTML should be used for any new websites and because some
people already configure their servers to deliver XHTML as Content-Type:
application/xhtml+xml when Mozilla is discovered to be the User-Agent, I
consider this bug to be severe. Therefore I set the Severity to Major.
Comment 1•23 years ago
|
||
See this bug too :-(
CVS based build 1 hour old, WinXP-SP1
Comment 2•23 years ago
|
||
Javascript works fine. document.write() does not work, since this is XML, not
HTML as far as Mozilla is concerned.
*** This bug has been marked as a duplicate of 111514 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•