On 11/22/13 8:40 AM, Benjamin Smedberg wrote:
> Is for..of on live DOM nodelists supposed to correctly iterate even
> when items are removed from the list? I have a testcase where this
> does not seem to be working correctly:
>
> http://jsfiddle.net/f8xzQ/
>
> Is there a simple way to do this correctly?

Well, there's this:
    http://jsfiddle.net/f8xzQ/1/

I think those iterators should be "live", like everything else in the
DOM! I mentioned this to anyone who would listen back when I made DOM
NodeLists iterable in the dumbest possible way, and got a lot of blank
stares. Certainly no one was interested in doing the work.

It's also possible to do this using a hand-JS-coded wrapper around
document.createNodeIterator, which is "live". Maybe not in all cases.

-j

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to