Closed Bug 533056 Opened 16 years ago Closed 16 years ago

Elements inside <noscript> block aren't added to DOM tree

Categories

(Core :: DOM: Core & HTML, defect)

1.9.1 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bsterne, Unassigned)

Details

Given the following: <div id="d">hello <b>world</b>!</div> <noscript id="n">hello <b>world</b>!</noscript> consider the following DOM calls: document.getElementById("d").childNodes.length 3 document.getElementById("d").firstChild.nodeValue hello document.getElementById("n").childNodes.length 1 document.getElementById("n").firstChild.nodeValue hello <b>world</b>! In short, the contents of the <noscript> element are added to the DOM as a single text node which can lead to confusing behavior for certain JS libraries making DOM calls. For example, if jQuery is added to the page above, then we get the following: $("#d").text() hello world! $("#n").text() hello <b>world</b>!
This is specified by the HTML5 spec and I think we'd want to keep it that way, see http://www.whatwg.org/specs/web-apps/current-work/?slow-browser#the-noscript-element ("Outside of head elements, if scripting is enabled for the noscript element - The noscript element must contain only text"). INVALID?
Yes. For one thing, if we didn't do this, then content inside <noscript> would load resources, etc. Definitely not desirable.
Indeed. We are simply following the HTML 5 spec here. If you disagree with what the spec says I'd recommend that you raise that with whatwg or the HTML wg.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.