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.
Nevermind - my mistake, did not not know each element in the page with an ID is accessible through window.