I think this is a doc bug. Holes in arrays are not properties, so any primitive method that calls a function "for each property" in the array should not call for those ids that index holes (i.e., for missing properties). Consider a js shell example: js> a = [1,2,3] 1,2,3 js> a.forEach(print) 1 0 1,2,3 2 1 1,2,3 3 2 1,2,3 js> delete a true js> a.forEach(print) 1 0 1,,3 3 2 1,,3 It would be odd to see a line for item 2 (element 1) after it was deleted, especially in light of the |this| value for the other two lines (1,,3). Shaver, can you render a verdict? /be
(In reply to comment #1) > I think this is a doc bug. More like a spec bug, in that it documents what was intentional behaviour, but I now agree that it's not desirable. Do we have compatibility issues here if we change it now?
I'll keep watching this bug for a decision on whether the doc or the implementation gets changed.
I agree with Brendan here: this should be a documentation bug. I've updated the MDC docs for all the array extras to indicate that they do not act upon array indexes which have not been assigned or which have been deleted (at the time of being visited). Also, the JS implementations I plan to add to each page (for use when the user's browser doesn't support the extras) will obey this rule as well.
So, does that mean we can resolve this bug, or is there more left to be done?
I'm marking this fixed now, since it seems to be. If anyone disagrees, please reopen and say what's still not done so we can get it taken care of.
(In reply to comment #7) > see bug 390592 for the test and bug 311082 for the discussion. The first bug # is wrong.