If there's no previous script tag on the page, won't scripts.parentNode throw a (Cannot read property parentNode of undefined) error ?
also any for in loop should use hasOwnProperty to protect for any prototype modifications on the page.
1) You're always going to have a script tag on the page, because you need to add the script above somehow
Very true! Good point =)
You also might want to wrap this in a function to protect the variable namespaces.
As you don't use the object keys, maybe it would be better to loop an array instead (performance).
How about now?
i use a window onload version. look https://gist.github.com/jswebschmiede/3660918
Similar to this one: https://gist.github.com/necolas/1025811 , although i find that one much better.
How about to pass the "document" as parameter into scope?
i think pass 'document' into scope is better