alert(document.body.childNodes.item === "[object]");
is true.
Why is childNodes.item returning "[object]" ?
Garrett
Because it is a collection:
.item(0), .item(1), I think.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Item should be a Host object, not a string value. In fact, item() is
callable, so it could reasonably be considered a function
(implementation dependent). Method item() also seems to implement
[[call]] in IE:-
:-
javascript:alert(Function.prototype.call.call(document.body.childNodes,
document.body.childNodes.item, 0))
(But that's beside the point.)
My original example:-
alert(document.body.childNodes.item === "[object]");
Uses strict equality, ===
With strict equality, when comparing an object and a string value, the
result should be false (as is true with strict comparison of any two
obects of different types).
Is - item - an object or a string value?
It appears [[Get]] would find - item - on - childNodes - directly:-
javascript:alert(Object.prototype.hasOwnProperty.call(document.body.childNodes,
"item"))
I'm at a loss as to understand why [[Get]] returns "[object]" for the
- item - property.
Garrett