Closed
Bug 87975
Opened 24 years ago
Closed 24 years ago
HTML w/ JS vs XHTML w/ JS - buttons do not work
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
VERIFIED
INVALID
People
(Reporter: drepper, Assigned: joki)
Details
(Keywords: xhtml)
Attachments
(6 files)
I was trying to convert some HTML files into XHTML and stumbled across some
problems with Javascript. I've looked a bit through the Bugzilla database and
couldn't find a problem. This is filed against Javascript but perhaps it's
something else. Maybe even a problem on my side.
I'll append two files: one HTML file, the other XHTML. They should be
equivalent and are indeed rendered more or less the same. But pressing the
buttons (which invokes a Javascript routine) doesn't work. I know the routines
are parsed since deliberately adding syntax errors make them show up in the
Javascript console.
This is with today's (2001-6-26's) CVS version but I've seen this for longer.
| Reporter | ||
Comment 1•24 years ago
|
||
| Reporter | ||
Comment 2•24 years ago
|
||
Comment 3•24 years ago
|
||
Confirming bug with Mozilla binary 20010621xx WinNT. OS : Linux --> All.
The <SCRIPT> block in the XHTML testcase looks like this:
<script language="JavaScript1.2">
<![CDATA[
function doHide(hide)
{
var p = document.getElementById("ll");
if (hide) {
p.setAttribute("class", "hide");
} else {
p.removeAttribute("class");
}
}
]]>
</script>
If I save the XHTML testcase locally and load it in Mozilla, I see this
error in the JavaScript Console:
Error: syntax error
Source File: (local path)/87975_40247.xhtml
Line: 15
Source Code: <![CDATA[
For some reason, I do not see this error when I load the testcase off
the Bugzilla server. Nevertheless, this must be the key to the problem -
Comment 4•24 years ago
|
||
I would like to reassign this to the DOM component for further analysis.
Is this perhaps a Parser issue? Is there something in JS Engine that needs
to be done in order for "<![CDATA[" to be accepted? I have never seen
this before -
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
OS: Linux → All
QA Contact: pschwartau → desale
Hardware: PC → All
| Reporter | ||
Comment 5•24 years ago
|
||
I also tried it without the <![CDATA[ stuff with the same effect. So the
<![CDATA problem is not the only one (unless the missing <![CDATA[ makes the
script unusable by the JavaScript engine).
Comment 6•24 years ago
|
||
You have to erase both the
<![CDATA[
and the
]]>
At least, when I do that the testcase runs fine in Mozilla -
does that work for you, too?
| Reporter | ||
Comment 7•24 years ago
|
||
I know that ]]> has to be removed as well (I'm using and writing software for
SGML for about 10 years now, so I do know the syntax and semantics of all this :-).
And no, this doesn't solve the problem. In fact, this is what I tried first.
I've added the CDATA stuff only afterwards to make things "easier" to digest for
the XML parser.
Comment 8•24 years ago
|
||
Comment 9•24 years ago
|
||
Using Mozilla binaries 20010621xx WinNT, 20010615xx Linux, 20010615xx Mac.
On all three platforms, the XHTML testcase fails when it includes the
CDATA open/close, and succeeds when the CDATA open/close is removed.
Will try with newer builds when I get a chance -
Ulrich - if this doesn't work for you, do you see any errors in
the JavaScript Console?
| Reporter | ||
Comment 10•24 years ago
|
||
OK, I see the problem now.
Your modified text works for me, too. But: if I convert it into Unix-style
(i.e., convert CRNL into NL) it doesn't work anymore. It seems the parser
assumes the
braindamaged DOS-style text format.
| Reporter | ||
Comment 11•24 years ago
|
||
Oh, and I forgot, this still leaves the question unanswered why the <![CDATA[
stuff cannot be used. Look, for instance, in the file
content/xml/tests/script.xml
in the mozilla source tree. It uses the same syntax.
| Reporter | ||
Comment 12•24 years ago
|
||
| Reporter | ||
Comment 13•24 years ago
|
||
More news.
The problem actually is that if a file loaded with the suffix .xml or .xhtml it
won't work but it does work if it is a suffix which is not known. Similarly
things to work if the content type is not text/xml. This is why the third
attachment works, but not the one I appended.
To reproduce it, first look at the third attachment above directly. it should
work just fine. Then download the file and save it as t.xml. Load it using
file:///..../t.xml. It shouldn't work. Rename the file to t.xml-t and load
file;///..../t.xml-t and it should work.
For somebody who knows the difference the content type information makes in the
parsers should get an idea now.
I'm changing the component to XML since this is most probably a parser issue.
Component: DOM Level 0 → XML
Comment 14•24 years ago
|
||
Setting default owner and QA for chosen component - XML
Assignee: jst → heikki
QA Contact: desale → petersen
| Reporter | ||
Comment 15•24 years ago
|
||
And it's getting stranger. Well, at least for me.
I'll append another example where additionally SVG is used (you'll need a
browser with SVG enabled at build time).
If the file loaded with .xml suffix or text/xml content type everything is
rendered correctly. Including the SVG part. But the buttons won't work. If
the file is loaded with a different suffix (.xml-u in my case) or a content type
!= text/xml the buttons do work but the SVG is *not* rendered at all.
I think this qualifies this problem as critical since there is no way to work
around the bug and get everything working. I'm appending the test case now.
QA Contact: petersen → desale
| Reporter | ||
Comment 16•24 years ago
|
||
CDATA section should have no effect, we should (at least we used to) treat it
correctly. Likewise, newline format should be irrelevant, and obviously things
should also work with XML mime type.
I am pretty sure this is a regression. If someone could go the trouble and try
pinpoint when this happened it'd be great. vidur and maybe somebody else landed
some changed to make scripts work dynamically, so maybe that caused a regression...
Severity: normal → major
Priority: -- → P2
Target Milestone: --- → mozilla0.9.3
Doh, found out a document whose root element is script does not work in XML.
I'll fix that at the same time.
Status: NEW → ASSIGNED
Keywords: xhtml
| Reporter | ||
Comment 19•24 years ago
|
||
Just to be sure there is no confusion, the newline format is no problem. It's
just that I've stored the file without the CR under a name no content type could
be derived from. The problems are CDATA and the XML content type handling.
Priority: P2 → --
I suspect this is a duplicate of bug 47319.
This is not an XML problem per se, I think. I put dump() statements in the JS:
one to output something when the JS was loaded and one when doHide was called.
The first one produced output when the document was loaded, but the second one
was never called. Works the same way with or without a CDATA section.
Thus, it seems that the button click message gets lost somewhere, and we do not
call the JS function that is in the onclick attribute.
Sending to Event Handling.
Assignee: heikki → joki
Status: ASSIGNED → NEW
Component: XML → Event Handling
QA Contact: desale → madhur
Summary: HTML w/ JS vs XHTML w/ JS → HTML w/ JS vs XHTML w/ JS - buttons do not work
Target Milestone: mozilla0.9.3 → ---
| Reporter | ||
Comment 21•24 years ago
|
||
Well, maybe the button handling is for the Event Handling component.
But what is about the SVG output not being visible? I definitely think there is
something wrong with the content type handling.
SVG will only work if the mime type is an XML type - which makes sense since SVG
is an XML language. Same with MathML, XLink, XHTML (don't confuse this with HTML
here) etc.
I am working on the script-as-root in another bug.
Comment 23•24 years ago
|
||
This is a very probable duplicate of bug #27403, which covers CDATA sections in
scripts for XHTML documents served as text/html.
Comment 24•24 years ago
|
||
Maybe not. I looked at my JavaScript console and got two different error
messages for the two testcases. Sorry for the spam.
Comment 25•24 years ago
|
||
XHTML, being a subset of XML, is case-sensitive, and all HTML tags and
attributes have to be in lower case. This includes events such as onClick. I
took the second attachment, "XHTML version which doesn't work," fixed the
capitalization to make it "onclick" instead of "onClick" and it works.
Comment 26•24 years ago
|
||
I think kelson is right. Therefore this bug is INVALID, marking as such.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Comment 28•24 years ago
|
||
As per developers comments, marking verified invalid
Status: RESOLVED → VERIFIED
Updated•7 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•