Nested forms breaking table structure when created via innerHTML

RESOLVED FIXED

Status

()

Core
HTML: Parser
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: Tom Southwood, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed by the HTML5 parser])

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
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

Comment 1

8 years ago
Created attachment 441612 [details]
testcase

Comment 2

8 years ago
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: 373864
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
Last Resolved: 8 years ago
Resolution: --- → FIXED

Updated

8 years ago
Depends on: 561085

Updated

8 years ago
No longer depends on: 561085
You need to log in before you can comment on or make changes to this bug.