Closed Bug 492925 Opened 15 years ago Closed 14 years ago

MediaList[i] reports undefined, not the value from .item(i)

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: kpdecker, Assigned: bzbarsky)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4

The MediaList array accessor API always returns undefined when valid indexes are passed.

I'm not sure where this lies in the spec, but it was unexpected for me as other FF objects that define the item() accessor in the spec also define an array accessor. This is more of a consistency item rather than a strict spec compliance issue.

Reproducible: Always

Steps to Reproduce:
See the referenced page.

      for (var i = 0; i < rule.media.length; i++) {
        out.push(i + ": " + rule.media[i]);
      }

      for (var i = 0; i < rule.media.length; i++) {
        out.push(i + ": " + rule.media.item(i));
      }


Actual Results:  
media[i] returns undefined
media.item(i) returns correct value

Expected Results:  
media[i] === media.item(i) for all i

Tested under 3.5b4 and 3.0.10
Product: Firefox → Core
QA Contact: general → general
Confirmed with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.3a5pre) Gecko/20100418 Minefield/3.7a5pre. Thanks for the testcase! It would probably be best if you attached it here using 'Add an attachment' link on this page, since the testcases have the tendency to disappear after some time from external sites...
Severity: minor → normal
Component: General → DOM: CSS Object Model
Keywords: testcase
OS: Windows XP → All
QA Contact: general → general
Hardware: x86 → All
Summary: MediaList.item[i] reports undefined → MediaList[i] reports undefined, not the value from .item(i)
Version: unspecified → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file Testcase
Attached patch FixSplinter Review
Kevin, nice catch!  Looks like the code to make all this work has been around for years, but never actually got run....
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #439927 - Flags: review?(jst)
Attachment #439927 - Flags: review?(jst) → review+
Pushed http://hg.mozilla.org/mozilla-central/rev/302e3ead2b3e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: