Hello, so I did a lot of digging.
First you'll find a jquery fork with an simple example to reproduce the bug here: https://github.com/vvo/jquery/tree/double_script_bug.
Here I copy paste my commit log:
What I have found:
The double script bug is easily reproductible.
- Clear your browser cache
- Use any network observer
- cd jquery, launch http-server . -p 80 (npm install http-server)
- browse with IE9 and network observer to http://ip:80
- see double script loading. One for script.js, other for
But still it is loaded twice!
I used "blind man debugging" (putting returns and reloading the page
untill no more script/only one script loads)
fragment = jQuery.buildFragment( args, this[ 0
].ownerDocument, false, this );
This function will create a new dom fragment element using the ajax
request response text. If you return; just before this call, of course
your page will fail but you'll see that there's no more script loaded.
Then if you return just after, you'll see that there's the script.js
The second load of scirpt.js?timestamp is done by the append function:
this.appendChild( elem );
So, creating a fragment with a <script src> in it will download the
script once, then appending will download the script again (with a
timestamp added, the timestamp is not a problem, this is the standard
jQuery procedure of loading <scripts> in ajax calls)
What we should do I guess is replace() just before creating the fragment
to pre-add the timestamp to the script.
As I just discovered jQuery core, I need some advice here.