JamesMGreene / jWalker

A well-tested cross-browser JavaScript implementation of the TreeWalker class defined in the W3C specification for DOM Traversal (DOM Level 2).
http://jamesmgreene.github.com/jWalker/
MIT License
2 stars 1 forks source link

NodeIterator #1

Closed brettz9 closed 11 years ago

brettz9 commented 11 years ago

Hi,

Nice to see the TreeWalker implementation!

I was wondering whether you might be able to implement NodeIterator using DOMNodeRemoved events? Might not be cross-browser, but could at least provide a reference implementation and allow customization of the behavior.

JamesMGreene commented 11 years ago

I'm sorry to say that building a NodeIterator implementation that doesn't work in all browsers is definitely not very high on my priority list. Additionally, the use of Mutation Events will cause notable performance degradation.

Realistically, though, I'll also warn you that you would probably need to listen to way more events than just the DOMNodeRemoved event. I'm thinking you would actually have to listen to all of the Mutation Events as any one of them could impact the associated filter function as well:

I'm pretty sure it's a bigger task to take on than you're expecting. Unless you can figure out a way to do this in "oldIE" as well (IE7-8), then I wouldn't even likely accept a Pull Request for this feature addition either as the whole goal of the jWalker library is to provide cross-browser support for the Node Traversal APIs.