From 136a459f4c24880f6d07f26c07e56451385637e0 Mon Sep 17 00:00:00 2001 From: John Resig Date: Mon, 9 Feb 2009 15:41:50 +0000 Subject: [PATCH] Optimized the clean() code to no longer use .trim() (speeds up working against long HTML in IE). Fixes #4037. --- src/core.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core.js b/src/core.js index 3f6c1f7..3a9eaa7 100644 --- a/src/core.js +++ b/src/core.js @@ -855,7 +855,7 @@ jQuery.extend({ }); // 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 @@ -895,11 +895,12 @@ jQuery.extend({ if ( !jQuery.support.tbody ) { // String was a , *may* have spurious - var tbody = !tags.indexOf(" or - wrap[1] == "
" && tags.indexOf("" && !hasBody ? div.childNodes : []; -- 1.7.10.4