Skip to main content

Bug Tracker

Side navigation

Ticket #4037: clean-2.diff


File clean-2.diff, 0.9 KB (added by dimi, February 01, 2009 09:13AM UTC)

Patch two

--- jquery-1.3.1.js	2009-02-01 04:08:08.000000000 -0500
+++ jquery-1.3.1-c.js	2009-02-01 04:07:57.000000000 -0500
@@ -866,7 +866,7 @@
 				});
 
 				// Trim whitespace, otherwise indexOf won't work as expected
-				var tags = jQuery.trim( elem ).toLowerCase();
+				var tags = elem.replace(/^\s+/, '').substring(0, 10).toLowerCase();
 
 				var wrap =
 					// option or optgroup
@@ -906,11 +906,12 @@
 				if ( !jQuery.support.tbody ) {
 
 					// String was a <table>, *may* have spurious <tbody>
-					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
+				    	var hasBody = /<tbody/i.test(elem);
+					var tbody = !tags.indexOf("<table") && !hasBody ?
 						div.firstChild && div.firstChild.childNodes :
 
 						// String was a bare <thead> or <tfoot>
-						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
+						wrap[1] == "<table>" && !hasBody ?
 							div.childNodes :
 							[];

Download in other formats:

Original Format