Commit 136a459f authored by John Resig's avatar John Resig

Optimized the clean() code to no longer use .trim() (speeds up working against...

Optimized the clean() code to no longer use .trim() (speeds up working against long HTML in IE). Fixes #4037.
parent 6b938e1c
...@@ -855,7 +855,7 @@ jQuery.extend({ ...@@ -855,7 +855,7 @@ jQuery.extend({
}); });
// Trim whitespace, otherwise indexOf won't work as expected // 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 = var wrap =
// option or optgroup // option or optgroup
...@@ -895,11 +895,12 @@ jQuery.extend({ ...@@ -895,11 +895,12 @@ jQuery.extend({
if ( !jQuery.support.tbody ) { if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody> // String was a <table>, *may* have spurious <tbody>
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? var hasBody = /<tbody/i.test(elem),
div.firstChild && div.firstChild.childNodes : tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot> // String was a bare <thead> or <tfoot>
wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? wrap[1] == "<table>" && !hasBody ?
div.childNodes : div.childNodes :
[]; [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment