Closed Bug 775806 Opened 13 years ago Closed 13 years ago

Some DOM properties are enumerable, but are not on the prototype chain

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: espadrine, Unassigned)

Details

All properties should be accessible from a prototype chain look-up. Yet, some DOM properties, like |window.locationbar|, are inaccessible from a prototype chain look-up. We can notice this phenomenon because we can access those "inaccessible" properties, if they are enumerable, from |for(var prop in obj) { … }|. Full data including comparison with Google Chrome (who also has "inaccessible" properties) and Opera (who does not) are available here: http://pastebin.mozilla.org/1708945.
The testcase is broken, because it does this: names.concat(getScope(obj)); That creates a new array object and throws it away. So getScope is ignoring all the properties that are on the prototype chain. If it works in Opera, that means they place all those properties directly on the window, not on the prototype Fixing that to do: names = names.concat(getScope(obj)); makes all the "leaks" go away, as expected.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Oops. I can't believe I did that. Sorry.
Not a problem. The "some methods mutate the array and some don't" thing in JS is pretty screwed up. ;)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.