WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
152454
Object.keys returns length property of some DOM Objects
https://bugs.webkit.org/show_bug.cgi?id=152454
Summary
Object.keys returns length property of some DOM Objects
Felquis
Reported
2015-12-18 18:03:57 PST
Hello Object.keys(document.styleSheets) returns ['0', 'length'] while other browsers returns ['0'].. Object.keys(document.querySelectorAll('div')) also returns the 'length' as a key.. but in Chrome, Firefox and Opera does not. So I think it is a Safari issue. Tested into Version 9.0.2 (10601.3.9), may affect iOS and probably affect others DOM Object TokenLists and Collections, for example HTMLCollection `Object.keys(document.body.children)` also returns the length property... It is breaking my code here
https://github.com/felquis/CSSOM-Query/issues/1
Thanks..
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2022-07-27 04:19:15 PDT
I am able to reproduce this issue while running these two in console on this page in Safari 15.6 on macOS 12.5 and other browsers: *** Safari 15.6 on macOS 12.5 *** For Object.keys(document.styleSheets); - it returns ["0", "1", "2"] (3) For Object.keys(document.querySelectorAll('div')); - it returns ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", …] (38) *** Firefox Nightly 105 & Chrome Canary 106 *** For first - (2) ['0', '1'] For second - (16) ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'] ____ If I am testing wrong then please ignore me but just wanted to share updated results. Thanks!
Ryosuke Niwa
Comment 2
2022-07-27 11:47:33 PDT
Not reproducing this anymore. We likely fixed it in recent bindings improvements.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug