Closed Bug 315048 Opened 19 years ago Closed 13 years ago

Array.map generic doesn't iterate through XMLList object

Categories

(Core :: JavaScript Engine, enhancement)

PowerPC
macOS
enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jasonkarldavis, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051026 Camino/1.0+ Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20051102 Firefox/1.6a1 The Array.map shorthand only works for objects which expose a .length property. XMLList() has a .length() method, and therefore cannot be "mapped" without writing your own map() method. __defineGetter__ on the prototype cannot be used as a workaround either, as it could conflict with possible <length/> xml markup. Ideally Array.map should look for a .length() method if a .length property is not found, or at least make an exception for XMLList inputs. Reproducible: Always Steps to Reproduce: 1. Click on associated javascript: uri Actual Results: Empty alert box Expected Results: Alert box containing "a,b,c"
This is an E4X design flaw. Something to fix for Edition 4. /be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: e4x
We shouldn't mess with ES5 defined stuff.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.