This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26346 - DOMRectList::item(): is it zero-based index?
Summary: DOMRectList::item(): is it zero-based index?
Status: RESOLVED FIXED
Alias: None
Product: FXTF
Classification: Unclassified
Component: Geometry (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: sideshowbarker+geometry
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-15 23:18 UTC by Adenilson Cavalcanti
Modified: 2014-07-18 20:28 UTC (History)
2 users (show)

See Also:


Attachments

Description Adenilson Cavalcanti 2014-07-15 23:18:12 UTC
In Section 4 DOMRectList interface, the getter method item() description says that "when invoked, must throw an IndexSizeError exception when index is greater than the number of DOMRect objects associated with the object. Otherwise, the DOMRect object at index must be returned."

Perhaps it should also define if it is zero or one based? (e.g. item(0) returns the first element if the list is non empty).
Comment 1 Dirk Schulze 2014-07-17 07:49:15 UTC
I made DOMRectList an ArrayClass. Need to check with heycam if it is still required to explicitly specify if it is zero-based index
Comment 2 Adenilson Cavalcanti 2014-07-17 17:44:46 UTC
Dirk

If you are talking about a javascript Array class (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), it is explicitly defined as "JavaScript arrays are zero-indexed".
Comment 3 Dirk Schulze 2014-07-18 20:00:55 UTC
(In reply to Adenilson Cavalcanti from comment #2)
> Dirk
> 
> If you are talking about a javascript Array class
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
> Global_Objects/Array), it is explicitly defined as "JavaScript arrays are
> zero-indexed".

I will state "Indices are zero-based."