Closed
Bug 505173
Opened 16 years ago
Closed 15 years ago
</> closes an <xml> element
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: Visweswaran.Swaminathan, Unassigned)
Details
(Whiteboard: [fixed by the HTML5 parser])
Attachments
(1 file)
|
408 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.33 Safari/530.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1
Firefox renders the actual data inside the CDATA because it misinterprets the characters "]" "]" and ">" in the CDATA as end tags even though they don't appear continuously as "]]>"
In the following example the CDATA has the characters "]" and ">" before the actual ending tag "]]>".
<html xmlns="http://www.w3.org/1999/xhtml" lang="it">
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World Example</h1>
<![CDATA[
[test][test]
<h1>This text should note be displayed</h1>]]>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
1.Copy the example html code given in the details section
2.Open it in the Firefox browser
Actual Results:
Firefox displays the text in the CDATA "This text should note be displayed]]>"
Expected Results:
The text in the CDATA section shouldn't be displayed
Updated•16 years ago
|
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → parser
Version: unspecified → 1.9.1 Branch
Comment 1•16 years ago
|
||
The text within the CDATA should be displayed as text. I see the header line followed by the text:
"[test][test]<h1>This text should note be displayed</h1>"
displayed, which looks correct to me.
Is this not what you are seeing?
In the browser I see only the following
"Hello World Example
This text should not be displayed]]>"
If I remove "[test][test]" from CDATA, then the browser just displays "Hello World Example"
Comment 3•16 years ago
|
||
This WFM in both these cases:
a) When served as XHTML - "[test][test]<h1>This text should note be displayed</h1>"
b) Using the HTML5 parser - "This text should note be displayed]]>"
When served as text/html, with the current parser, I see the two results mentioned above.
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko/20090720 Minefield/3.6a1pre ID:20090720042210
Comment 4•16 years ago
|
||
AFAICT this is intentional; As text/html doesn't support CDATA sections the suppressed section is "<![...]...>" - ie the first ">" after the "]" to cover things like <![endif]-->
Probably => invalid
Summary: CDATA closing tag is assumed even though "]]>" is not continious as a string. → CDATA closing tag is assumed even though "]]>" is not continuous as a string.
I think I have over simplified the previous example code. The following code is better form of how we use. Save the following code as HTML and open in the browser.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it">
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World Example</h1>
</body>
<xml style="display:none">
<![CDATA[]></>This text should not be displayed]]>
</xml>
</html>
In our usage we embed a whole XML document in the CDATA section but for simplicity and to reproduce the issue the we have added few characters “]></>” in the CDATA section and made the browser to display “This text should not be displayed]]>”.
We believe that the HTML parser is misinterpreting some of the characters in the CDATA section as end tags and displays the remaining text in the CDATA.
Note: If we save the above code as XHTML, the Firefox browser renders correctly.
We have tested the same with Safari 3 and IE 7, both render correctly.
Hi All,
Has anybody reproduced the issue ? Any response would be appreciated.
Comment 7•16 years ago
|
||
I can't help with the issue itself but
>Save the following code as HTML
Why do you don't attach it as html file (add an attachment) ?
Comment 9•15 years ago
|
||
The HTML5 parser doesn't close the <xml> element early.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Summary: CDATA closing tag is assumed even though "]]>" is not continuous as a string. → </> closes an <xml> element
Whiteboard: [fixed by the HTML5 parser]
You need to log in
before you can comment on or make changes to this bug.
Description
•