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
22
src/event.js
22
src/event.js
|
@ -1,10 +1,12 @@
|
|||
(function( jQuery ) {
|
||||
|
||||
var rnamespaces = /\.(.*)$/,
|
||||
rformElems = /^(?:textarea|input|select)$/i,
|
||||
rperiod = /\./g,
|
||||
rspace = / /g,
|
||||
rescape = /[^\w\s.|`]/g,
|
||||
fcleanup = function( nm ) {
|
||||
return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
|
||||
return "\\" + ch;
|
||||
});
|
||||
return nm.replace(rescape, "\\$&");
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -339,7 +341,7 @@ jQuery.event = {
|
|||
jQuery.event.trigger( event, data, parent, true );
|
||||
|
||||
} else if ( !event.isDefaultPrevented() ) {
|
||||
var target = event.target, old, targetType = type.replace(/\..*$/, ""),
|
||||
var target = event.target, old, targetType = type.replace(rnamespaces, ""),
|
||||
isClick = jQuery.nodeName(target, "a") && targetType === "click",
|
||||
special = jQuery.event.special[ targetType ] || {};
|
||||
|
||||
|
@ -697,9 +699,7 @@ if ( !jQuery.support.submitBubbles ) {
|
|||
// change delegation, happens here so we have bind.
|
||||
if ( !jQuery.support.changeBubbles ) {
|
||||
|
||||
var formElems = /textarea|input|select/i,
|
||||
|
||||
changeFilters,
|
||||
var changeFilters,
|
||||
|
||||
getVal = function( elem ) {
|
||||
var type = elem.type, val = elem.value;
|
||||
|
@ -724,7 +724,7 @@ if ( !jQuery.support.changeBubbles ) {
|
|||
testChange = function testChange( e ) {
|
||||
var elem = e.target, data, val;
|
||||
|
||||
if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
|
||||
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -788,13 +788,13 @@ if ( !jQuery.support.changeBubbles ) {
|
|||
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
|
||||
}
|
||||
|
||||
return formElems.test( this.nodeName );
|
||||
return rformElems.test( this.nodeName );
|
||||
},
|
||||
|
||||
teardown: function( namespaces ) {
|
||||
jQuery.event.remove( this, ".specialChange" );
|
||||
|
||||
return formElems.test( this.nodeName );
|
||||
return rformElems.test( this.nodeName );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ function liveHandler( event ) {
|
|||
}
|
||||
|
||||
function liveConvert( type, selector ) {
|
||||
return (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
|
||||
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
|
||||
}
|
||||
|
||||
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue