I just found at the script tag id’s in chrome are created are stored on the window object.
<script id="deploy" type="text/html">blah</script>
window.deploy = ➜
<script id="deploy" type="text/html">blah</script>
Object.keys(window) does not include “deploy”
So my question
Is there anyone who has found a solution to this (prevent chrome from polluting my world) the only thing I have come up with
is the following:-
$('script[type="text/html"]').each ->
# stuff
delete window[@.getAttribute 'id']
My “solution” risks deleting a global variable when not in chrome.
However without my solution chrome can overwrite global variables if the script id clashes.
WHAT A MESS!
Any help appreciated!
What I came up with:
This checks to see if the global is the same as the node before it deletes it.
Note that this happens with each ID, not only
scripttags. And it shouldn’t be polluting your global scope, as Yoshi said, but the above solution should work for you.