Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes #8098. Use the fast document.head when available. Don't set unn…

…eeded "script.type = text/javascript".
  • Loading branch information...
commit 462bb1f66abf239492ee33c60feee3402fe64f77 1 parent fdd4101
Mathias Bynens authored January 24, 2011 jitter committed February 02, 2011
6  speed/jquery-basis.js
@@ -524,11 +524,9 @@ jQuery.extend({
524 524
 		if ( data && rnotwhite.test(data) ) {
525 525
 			// Inspired by code by Andrea Giammarchi
526 526
 			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
527  
-			var head = document.getElementsByTagName("head")[0] || document.documentElement,
  527
+			var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
528 528
 				script = document.createElement("script");
529 529
 
530  
-			script.type = "text/javascript";
531  
-
532 530
 			if ( jQuery.support.scriptEval ) {
533 531
 				script.appendChild( document.createTextNode( data ) );
534 532
 			} else {
@@ -5060,7 +5058,7 @@ jQuery.extend({
5060 5058
 		// If we're requesting a remote document
5061 5059
 		// and trying to load JSON or Script with a GET
5062 5060
 		if ( s.dataType === "script" && type === "GET" && remote ) {
5063  
-			var head = document.getElementsByTagName("head")[0] || document.documentElement;
  5061
+			var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
5064 5062
 			var script = document.createElement("script");
5065 5063
 			script.src = s.url;
5066 5064
 			if ( s.scriptCharset ) {
2  src/ajax/script.js
@@ -34,7 +34,7 @@ jQuery.ajaxTransport( "script", function(s) {
34 34
 	if ( s.crossDomain ) {
35 35
 
36 36
 		var script,
37  
-			head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
  37
+			head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
38 38
 
39 39
 		return {
40 40
 
6  src/core.js
@@ -574,10 +574,8 @@ jQuery.extend({
574 574
 		if ( data && rnotwhite.test(data) ) {
575 575
 			// Inspired by code by Andrea Giammarchi
576 576
 			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
577  
-			var head = document.getElementsByTagName("head")[0] || document.documentElement,
578  
-				script = document.createElement("script");
579  
-
580  
-			script.type = "text/javascript";
  577
+			var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
  578
+				script = document.createElement( "script" );
581 579
 
582 580
 			if ( jQuery.support.scriptEval() ) {
583 581
 				script.appendChild( document.createTextNode( data ) );
2  src/manipulation.js
@@ -7,7 +7,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
7 7
 	rtbody = /<tbody/i,
8 8
 	rhtml = /<|&#?\w+;/,
9 9
 	rnocache = /<(?:script|object|embed|option|style)/i,
10  
-	// checked="checked" or checked (html5)
  10
+	// checked="checked" or checked
11 11
 	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
12 12
 	wrapMap = {
13 13
 		option: [ 1, "<select multiple='multiple'>", "</select>" ],

0 notes on commit 462bb1f

Please sign in to comment.
Something went wrong with that request. Please try again.