Closed Bug 546289 Opened 15 years ago Closed 15 years ago

Nested forms breaking table structure when created via innerHTML

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: schmoose, Unassigned)

References

Details

(Whiteboard: [fixed by the HTML5 parser])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 If you insert a form usng javascript and said form contains a table containing a td which contains another form you get the table row ending as well as the nested form disappearing in the DOM, this only seems to happen on the first nested form. Reproducible: Always Steps to Reproduce: You can replicate using the js below. Note this only seems to happen when using js, if the html is inserted directly its all OK. html = '<form><table border="1"><tr><td>1<form></form></td><td>2</td></tr><tr><td>3<form></form></td><td>4</td></tr></table></form>';document.getElementById("<yourelementhere>").innerHTML = html; Actual Results: I got a wierd table, its almost as if the browser wrote a </tr> instead of the form. Expected Results: I expected my table to be OK
Attached file testcase (deleted) —
Thanks for the report! I can reproduce on trunk, but this works fine with the HTML5 parser <http://hsivonen.iki.fi/test-html5-parsing/>
Component: General → HTML: Parser
Depends on: html5-parsing
Product: Firefox → Core
QA Contact: general → parser
Summary: Nested forms breaking table structure → Nested forms breaking table structure when created via innerHTML
Whiteboard: [fixed by the HTML5 parser]
Version: unspecified → Trunk
Presumably the HTML5 parser does fixups similar to those for normal parsing during innerHTML sets.... But note that the markup in this case is invalid and is NOT implemented interoperably in browsers in general. Simple cases will work. Complicated stuff will break in nasty ways (non-tree DOM in IE, that sort of thing). Don't do it.
Marking FIXED per comment 2.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Depends on: 561085
No longer depends on: 561085
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: