WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
138779
Using document.appendChild to create a new element with ID attribute creates a property / global variable on window
https://bugs.webkit.org/show_bug.cgi?id=138779
Summary
Using document.appendChild to create a new element with ID attribute creates ...
Fabio Kenji
Reported
2014-11-16 11:18:20 PST
Created
attachment 241682
[details]
a web page with the steps used on the bug report It seems that when using the DOM API to create new nodes on a webpage and specifying an ID attribute, a global variable / property on window object is created with the same name as the specified ID. In the example attached, I am getting a reference to a paragraph in the body of the page. After that, I am creating a new div node and setting its id attribute to 'test_variable'. In the next lines, I am appending it into the paragraph node reference I had gotten earlier using appendChild(). After that code is run, a new property on window is created, window.test_variable, having the reference to a HTMLDivElementConstructor.
Attachments
a web page with the steps used on the bug report
(485 bytes, text/plain)
2014-11-16 11:18 PST
,
Fabio Kenji
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Fabio Kenji
Comment 1
2014-11-16 14:24:02 PST
Nevermind - my mistake, did not not know each element in the page with an ID is accessible through window.
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