Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
data-URI scripts insertion #1887
var s = document.createElement('script') s.src = 'data:,console.log(1)' document.body.appendChild(s) // output 1
but if insert this script by jQuery:
this is due to jQuery execute script by ajax of
fix this is simple, just set
by the way, anyone knows why jQuery set
I guess it logical to support this kind of stuff and seems fix for it is pretty easy. So i'd say yes, PR would be cool, don't forget to read the contribution guide - http://contribute.jquery.org/.
Wonder why we deviate from the spec here too, i remember we had a discussion about this, but don't remember specifics.
/cc @gibson042 ?
The problem was that a long time ago we used XHR and did this synchronously, and people started to depend on this by creating HTML-script-tag hybrids that expected the script to be run right after the HTML was injected into the document and be able to do something with it. Our change to full-time script tag when extracting the scripts from an HTML fragment still allows this but doesn't guarantee synchronicity, which is fine with me.