aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-07-19 15:57:43 +0000
committerJohn Resig <jeresig@gmail.com>2009-07-19 15:57:43 +0000
commitf57d93bf18a2d5c3b7a0b50da67cf6147aa389c3 (patch)
tree3f8d1976ad10e5105e7e770edada1ebedc0d2e6d /src/manipulation.js
parent0ac9898d6b7200075d20e36d7c31ad77585c8778 (diff)
downloadjquery-f57d93bf18a2d5c3b7a0b50da67cf6147aa389c3.tar.gz
jquery-f57d93bf18a2d5c3b7a0b50da67cf6147aa389c3.zip
Move cases of .replace(re, Function) out from inline (to avoid being redeclared on every use). Fixes #4114.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 0051bbc0b..f577cf837 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -4,7 +4,12 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rxhtmlTag = /(<(\w+)[^>]*?)\/>/g,
rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i,
rinsideTable = /^<(thead|tbody|tfoot|colg|cap)/,
- rtbody = /<tbody/i;
+ rtbody = /<tbody/i,
+ fcloseTag = function(all, front, tag){
+ return rselfClosing.test(tag) ?
+ all :
+ front + "></" + tag + ">";
+ });
jQuery.fn.extend({
text: function( text ) {
@@ -303,11 +308,7 @@ jQuery.extend({
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, function(all, front, tag){
- return rselfClosing.test(tag) ?
- all :
- front + "></" + tag + ">";
- });
+ elem = elem.replace(rxhtmlTag, fcloseTag);
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(rleadingWhitespace, "")