diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2018-03-07 20:09:09 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2018-05-14 14:09:43 -0400 |
commit | dc48b11e0c6c77e2b96e89a18f34d7b0c4f9a9d4 (patch) | |
tree | db4f37aee235c25bc970df56bb8359f2d1eddfde /src/ajax/script.js | |
parent | 1f4375a34227f42570d2b72e190e51bcfb1e8597 (diff) | |
download | jquery-dc48b11e0c6c77e2b96e89a18f34d7b0c4f9a9d4.tar.gz jquery-dc48b11e0c6c77e2b96e89a18f34d7b0c4f9a9d4.zip |
squash! Set attributes all at once, src last
Diffstat (limited to 'src/ajax/script.js')
-rw-r--r-- | src/ajax/script.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/ajax/script.js b/src/ajax/script.js index 292627f7e..410c82cab 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -48,19 +48,16 @@ jQuery.ajaxTransport( "script", function( s ) { var script, callback; return { send: function( _, complete ) { - script = jQuery( "<script>" ).prop( { - charset: s.scriptCharset, - src: s.url - } ).attr( s.scriptAttrs || {} ).on( - "load error", - callback = function( evt ) { + script = jQuery( "<script>" ) + .attr( s.scriptAttrs || {} ) + .prop( { charset: s.scriptCharset, src: s.url } ) + .on( "load error", callback = function( evt ) { script.remove(); callback = null; if ( evt ) { complete( evt.type === "error" ? 404 : 200, evt.type ); } - } - ); + } ); // Use native DOM manipulation to avoid our domManip AJAX trickery document.head.appendChild( script[ 0 ] ); |