Closed
Bug 725551
Opened 13 years ago
Closed 13 years ago
incorrect closing </head tag followed by a <body ...> throws away attributes on the <body>
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: zaumen, Unassigned)
Details
(Whiteboard: likely OK, needs checking against the spec)
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0
Build ID: 20120129161724
Steps to reproduce:
This is with Firefox 10.0 on Ubuntu Linux. The problem occurs with all add-ons off as well as on (in my case an 'unbuntu' add on and the no-script extension). I tried to use an onload attribute in an HTML BODY element and the function was not called. Setting window.onload worked, however, so I then modified the event handler so it would call document.getElementById, which worked as expected for a 'heading' element but not for a 'body' element (the IDs were "heading" and "body"). Three example files are concatenated and stored in example.txt. These files are named test1.html, test2.html, and test3.html. These are very short files constructed after the problem was noticed in a much larger application. While possibly separate problems, I suspect they are all related and due to the same cause.
Actual results:
test1.html did not display an alert.
test2.html displayed an alert as expected.
test3.html displayed and alert with one value false and the other true
Note: previous versions of Firefox did not seem to have this issue.
Expected results:
test1.html should have display an alert.
test2.html should display an alert.
test3.html should display an alert with both values set to true.
Your HTML examples contain errors, which is why they don't work. The closing HEAD tag is missing a >.
| Reporter | ||
Comment 2•13 years ago
|
||
Thanks - missed that totally. The example files were shortened from some existing HTML files that had worked as expected for some time: previously the onload script was called when the page loaded and getElementById("body") returned a non-null value, which was tested but not used beyond the test.
Apparently the latest version of Firefox reacts differently to HTML errors than the older versions do.
Comment 3•13 years ago
|
||
Do you know when this changed? The new "HTML5" parser was enabled in Firefox 4, IIRC, so if the behavior changed in that version, that's very likely intended...
I don't feel up to checking this case against the parsing specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/index.html#auto-toc-12
Component: Untriaged → HTML: Parser
Product: Firefox → Core
QA Contact: untriaged → parser
Summary: DOM problem with HTML BODY element and getElementById() → incorrect closing </head tag followed by a <body ...> throws away attributes on the <body>
Whiteboard: likely OK, needs checking against the spec
Version: 10 Branch → Trunk
Comment 4•13 years ago
|
||
Comment 5•13 years ago
|
||
This is correct behavior according to this specification. This is consistent with what Internet Explorer has done for ages.
Updated•13 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•