]> source.dussan.org Git - jquery.git/commitdiff
Fixes #8098. Use the fast document.head when available. Don't set unneeded "script...
authorMathias Bynens <mathias@qiwi.be>
Mon, 24 Jan 2011 10:18:57 +0000 (11:18 +0100)
committerAnton M <obhvsbypqghgc@gmail.com>
Tue, 1 Feb 2011 23:59:00 +0000 (00:59 +0100)
speed/jquery-basis.js
src/ajax/script.js
src/core.js
src/manipulation.js

index fff67764336509df305eef4c7013a134ee6fc9f1..6fe017c1c414102b1b7dbed2d754fda928a935c7 100644 (file)
@@ -524,11 +524,9 @@ jQuery.extend({
                if ( data && rnotwhite.test(data) ) {
                        // Inspired by code by Andrea Giammarchi
                        // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
-                       var head = document.getElementsByTagName("head")[0] || document.documentElement,
+                       var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
                                script = document.createElement("script");
 
-                       script.type = "text/javascript";
-
                        if ( jQuery.support.scriptEval ) {
                                script.appendChild( document.createTextNode( data ) );
                        } else {
@@ -5060,7 +5058,7 @@ jQuery.extend({
                // If we're requesting a remote document
                // and trying to load JSON or Script with a GET
                if ( s.dataType === "script" && type === "GET" && remote ) {
-                       var head = document.getElementsByTagName("head")[0] || document.documentElement;
+                       var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
                        var script = document.createElement("script");
                        script.src = s.url;
                        if ( s.scriptCharset ) {
index 731f5b609f3f4fa78dc912536d57d7cb70ac8128..34ddd04661e712c62ddebb9e82940ffc22f79ffc 100644 (file)
@@ -34,7 +34,7 @@ jQuery.ajaxTransport( "script", function(s) {
        if ( s.crossDomain ) {
 
                var script,
-                       head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
+                       head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
 
                return {
 
index 915ac6ba4502628c2005f47a0174fb3a281bfe57..2e63472361b150b3e2abcce9111ca1eb65b0eb48 100644 (file)
@@ -574,10 +574,8 @@ jQuery.extend({
                if ( data && rnotwhite.test(data) ) {
                        // Inspired by code by Andrea Giammarchi
                        // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
-                       var head = document.getElementsByTagName("head")[0] || document.documentElement,
-                               script = document.createElement("script");
-
-                       script.type = "text/javascript";
+                       var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
+                               script = document.createElement( "script" );
 
                        if ( jQuery.support.scriptEval() ) {
                                script.appendChild( document.createTextNode( data ) );
index 19a6c22ba8d4dd4b7aac8b50da802d897d98473f..841447fa2efcd801daca97eb4762d851f939e04e 100644 (file)
@@ -7,7 +7,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
        rtbody = /<tbody/i,
        rhtml = /<|&#?\w+;/,
        rnocache = /<(?:script|object|embed|option|style)/i,
-       // checked="checked" or checked (html5)
+       // checked="checked" or checked
        rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
        wrapMap = {
                option: [ 1, "<select multiple='multiple'>", "</select>" ],