Array.map generic doesn't iterate through XMLList object

RESOLVED WONTFIX

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED WONTFIX
13 years ago
7 years ago

People

(Reporter: Jason Davis, Unassigned)

Tracking

Trunk
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

13 years ago
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

Updated

10 years ago
Blocks: 246441
We shouldn't mess with ES5 defined stuff.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.