Open Raynos opened 12 years ago
new NodeIterator();
is undefined behaviour. I would normally just do window.NodeIterator = function () {}
so basically throw no exceptions at all.document.createNodeIterator() instance NodeIterator
to work. I would also do window.NodeIterator = document.createNodeIterator(document).constructor;
in Chrome."no exceptions at all" for new NodeIterator()
I don't think it a good idea. I think it must throw extension as in major browsers.
Why does it matter. It's completely undefined behaviour. There is no specification that says it should throw exceptions. It either does
Either way you cant do anything with the function, one is a silent failure the other is an aggressive failure. Note that the silent failure option is less bytes ;)
It's true, but in this case shim does the behavior that not in major browsers.
Any way https://github.com/termi1uc1/DOM-shim/commit/26cb56d2357f7bcda13c3b1eaa14894a4f94f55c
function NodeIterator() {}
function NodeIterator() { throwDOMException(9) }
something like this
There are a few questions of Implement NodeIterator (as for Implement NodeFilter and TreeWalker):
new NodeIterator()
):TypeError: Illegal constructor
withoutcode
property as Chrome and FF do orDOMException: NOT_SUPPORTED_ERR
withcode == 9
as Opera do?window
object, so user can dodocument.createNodeIterator(...) instanceof NodeIterator
or not?document.createNodeIterator(...) instanceof NodeIterator
is illegaldocument.createNodeIterator(...) instanceof NodeIterator
is legal