Applied the RegExp issues reported by Jeff Robinson here: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html Additionally broke out all remaining inline RegExp. Fixes #7062.
This commit is contained in:
parent
19b5d9e874
commit
9dc6e0c572
8 changed files with 66 additions and 50 deletions
|
@ -2,18 +2,13 @@
|
|||
|
||||
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
||||
rleadingWhitespace = /^\s+/,
|
||||
rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
|
||||
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
|
||||
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
|
||||
rtagName = /<([\w:]+)/,
|
||||
rtbody = /<tbody/i,
|
||||
rhtml = /<|&#?\w+;/,
|
||||
rnocache = /<script|<object|<embed|<option|<style/i,
|
||||
rnocache = /<(?:script|object|embed|option|style)/i,
|
||||
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
|
||||
fcloseTag = function( all, front, tag ) {
|
||||
return rselfClosing.test( tag ) ?
|
||||
all :
|
||||
front + "></" + tag + ">";
|
||||
},
|
||||
raction = /\=([^="'>\s]+\/)>/g,
|
||||
wrapMap = {
|
||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
legend: [ 1, "<fieldset>", "</fieldset>" ],
|
||||
|
@ -207,7 +202,7 @@ jQuery.fn.extend({
|
|||
|
||||
return jQuery.clean([html.replace(rinlinejQuery, "")
|
||||
// Handle the case in IE 8 where action=/test/> self-closes a tag
|
||||
.replace(/\=([^="'>\s]+\/)>/g, '="$1">')
|
||||
.replace(raction, '="$1">')
|
||||
.replace(rleadingWhitespace, "")], ownerDocument)[0];
|
||||
} else {
|
||||
return this.cloneNode(true);
|
||||
|
@ -235,7 +230,7 @@ jQuery.fn.extend({
|
|||
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
|
||||
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
||||
|
||||
value = value.replace(rxhtmlTag, fcloseTag);
|
||||
value = value.replace(rxhtmlTag, "<$1></$2>");
|
||||
|
||||
try {
|
||||
for ( var i = 0, l = this.length; i < l; i++ ) {
|
||||
|
@ -479,7 +474,7 @@ jQuery.extend({
|
|||
|
||||
} else if ( typeof elem === "string" ) {
|
||||
// Fix "XHTML"-style tags in all browsers
|
||||
elem = elem.replace(rxhtmlTag, fcloseTag);
|
||||
elem = elem.replace(rxhtmlTag, "<$1></$2>");
|
||||
|
||||
// Trim whitespace, otherwise indexOf won't work as expected
|
||||
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue