Closed Bug 644196 Opened 13 years ago Closed 13 years ago

innerHTML truncates after 200 document levels when document is not XHTML

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 354161

People

(Reporter: gargaj, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0

Under Firefox 4.0, feeding a string into an element's innerHTML will cause the innerHTML to be truncated after 200 document levels if the tag isn't a standard XHTML element, even when XML is specified. This also happens with empty clolsing tags. This didn't happen in 3.x.

Reproducible: Always

Steps to Reproduce:
1. Open http://dl.dropbox.com/u/3417034/ff4test.html
Actual Results:  
The output ends with <something num="199">

Expected Results:  
The output SHOULD end with <something num="299">

This doesn't happen if the tags are changed to standard tags like "input" or "br", or if the closing tags are specified explicitly (<something num='123'/></something>)

Again, Firefox 3.x didn't have this behaviour.
Interestingly, after a few tests, I found the following:

<ehsk/><ehsk/><ehsk/>

becomes

<ehsk><ehsk><ehsk></ehsk></ehsk></ehsk>

When parsed, which is clearly wrong - they should be siblings in the tree, not children.
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
> even when XML is specified.

None of your tests use XML.

> which is clearly wrong

No, that's correct parsing in HTML.  Those are unclosed tags.

I assume that all that's happening here is the tag misnesting protections from the parser kicking in.  Henri?
Component: DOM: Core & HTML → HTML: Parser
QA Contact: general → parser
I updated the test to be valid compliant XHTML, the bug still remains - the input string already was valid XML. The browser signals it parses them in Standards Compliant Mode.
> I updated the test to be valid compliant XHTML,

It's not compliant XHTML.  XHTML 1.0 says that XHTML documents can only be sent as text/html if they comply with Appendix C of that specification, which this document does not.

Or put more simply, if it's sent as text/html, then it's treated as HTML.  If you want it treated as XHTML, you need to send it as application/xhtml+xml.
Version: unspecified → Trunk
(In reply to comment #2)
> I assume that all that's happening here is the tag misnesting protections from
> the parser kicking in.  Henri?

Yeah, that should be it.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
OS: Windows 7 → All
Hardware: x86 → All
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.