Closed Bug 825743 Opened 12 years ago Closed 12 years ago

instanceof HTMLBodyElement is false for inserted HTMLBodyElement

Categories

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

20 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 824917

People

(Reporter: support, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.45 Safari/537.17

Steps to reproduce:

Tested this extension code in Firefox Nightly 20.0a1

window.document.addEventListener("DOMContentLoaded", function(evt) {
	if (evt.originalTarget instanceof HTMLDocument) {
		evt.originalTarget.addEventListener("DOMNodeInserted", function(evti) {
			if (evti.relatedNode.tagName == "BODY") {
				dump("Node: " + evti.relatedNode);
				dump(" / Test against instanceof HTMLBodyElement: "+ (evti.relatedNode instanceof HTMLBodyElement) +"\n");
			}
	}, true); }
}, true);



Actual results:

(evti.relatedNode instanceof HTMLBodyElement) was false for a HTMLBodyElement

Output:
Node: [object HTMLBodyElement] / Test against instanceof HTMLBodyElement: false


Expected results:

(evti.relatedNode instanceof HTMLBodyElement) should be true for a HTMLBodyElement

Output: (for example Firefox 17.0.1)
Node: [object HTMLBodyElement] / Test against instanceof HTMLBodyElement: true
Severity: normal → major
OS: Mac OS X → All
Hardware: x86 → All
Thanks for the report. This should be fixed in tomorrow's nightly.
Severity: major → normal
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Component: Untriaged → DOM
Product: Firefox → Core
Resolution: --- → DUPLICATE
Note that per spec the code above should in fact test false.  We might add a chrome-only spec violation, but that's what it would be: a spec violation....
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.