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 24662 - Spec for indexed access on Window doesn't match most browsers
Summary: Spec for indexed access on Window doesn't match most browsers
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-14 16:52 UTC by contributor
Modified: 2014-02-27 22:16 UTC (History)
11 users (show)

See Also:


Attachments

Description contributor 2014-02-14 16:52:34 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html
Multipage: http://www.whatwg.org/C#accessing-other-browsing-contexts
Complete: http://www.whatwg.org/c#accessing-other-browsing-contexts
Referrer: 

Comment:
Spec for indexed access on Window doesn't match most browsers

Posted from: 98.110.194.132 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:30.0) Gecko/20100101 Firefox/30.0
Comment 1 Boris Zbarsky 2014-02-14 16:53:31 UTC
See http://jsfiddle.net/vJ3PX/

IE is the only browser that maps [0] to the first frame in DOM order here.  Gecko, Blink, WebKit, and Presto all map it to the first frame in insertion order.
Comment 2 Ian 'Hixie' Hickson 2014-02-14 21:09:44 UTC
Yeah, this was intentional because matching insertion order seems highly unhelpful and since IE did the other one I presumed there was only a low risk of compat problems.

Are there actual compat problems here, or do you think it's better for authors to do the insertion order?
Comment 3 Boris Zbarsky 2014-02-14 22:26:19 UTC
I don't know.  I'm a bit worried about compat problems, yes, but have no hard data.  Insertion order is also a lot easier to implement in a performant way.
Comment 4 Ian 'Hixie' Hickson 2014-02-20 21:05:05 UTC
The three implementations using insertion order is a compelling argument, but it does seem quite inferior for authors, which seems more important than implementation complexity.

Anyone else have an opinion here?
Comment 5 Boris Zbarsky 2014-02-21 04:59:46 UTC
This API is pretty useless for authors in practice, I suspect, given ad scripts and like buttons and the like which may or may not insert iframes, more or less randomly from the author's point of view....
Comment 6 Eric Seidel 2014-02-25 01:21:13 UTC
Depending on frames[x] would be an extremely brittle way to code your page.  I suspect (but don't have any data!) that authors use window.frames just for iterating over all frames and not for depending on a specific frame ordering (which might change every time they redesign their page).  Maybe the first frame, frames[0] is stable enough that sites depend on that?

We could use-counter and possibly remove this accessor all together.
Comment 7 Ian 'Hixie' Hickson 2014-02-25 19:22:38 UTC
I doubt we can remove the accessor. In static pages, regardless of whether the order is tree order or insertion order, the order is predictable and stable (since the frames would be inserted in tree order). Even in dynamic pages, most of the time it'll be close to tree order.

Anyway, I'm happy to change the spec if we don't think tree order is actually that useful or if there's a compat need or if you're just not willing to change or something. IE using tree order seems like a sign that maybe we could use tree order if we agree it's better for authors. But if we don't, and you won't change, then three vs one seems like a slam dunk for the insertion order side.
Comment 8 contributor 2014-02-27 22:16:37 UTC
Checked in as WHATWG revision r8515.
Check-in comment: Make the spec match more UAs (frames[] is in insertion order, not tree order)
http://html5.org/tools/web-apps-tracker?from=8514&to=8515