Bug 17137 - Iterating over document.styleSheets omits numeric indices
Summary: Iterating over document.styleSheets omits numeric indices
Status: RESOLVED DUPLICATE of bug 8080
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: javascript:for (var i in document.syt...
Keywords: HasReduction
Depends on:
Reported: 2008-02-01 08:18 PST by Mike Walters
Modified: 2008-02-01 08:29 PST (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Walters 2008-02-01 08:18:43 PST
for(var i in document.styleSheets) <-- doesnt work
  document.styleSheets[i] is undefined always

for(var i=0; i<document.styleSheets.length; i++)
  document.styleSheets[i] works!
Comment 1 Mark Rowe (bdash) 2008-02-01 08:19:55 PST
The problem is that iterating over document.styleSheets only returns "item" and "length", not the numeric indices.  In Firefox it returns the numeric indices followed by "item" and "length".
Comment 2 Mark Rowe (bdash) 2008-02-01 08:26:20 PST
It seems this affects HTMLCollection along with StyleSheetList.  There are probably others.
Comment 3 Mark Rowe (bdash) 2008-02-01 08:29:36 PST
This is the same as bug 8080.

*** This bug has been marked as a duplicate of 8080 ***