Core: Move escape selector into its own module

Ref #9647
This commit is contained in:
Alexander Schmitz 2015-07-16 09:13:15 -04:00
parent 475ccefd97
commit 47188b7926
4 changed files with 25 additions and 9 deletions

View File

@ -22,6 +22,7 @@
"jquery",
"./data",
"./disable-selection",
"./escape-selector",
"./focusable",
"./version"
], factory );
@ -90,15 +91,7 @@ $.extend( $.ui, {
if ( element && element.nodeName.toLowerCase() !== "body" ) {
$( element ).trigger( "blur" );
}
},
// Internal use only
escapeSelector: ( function() {
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
return function( selector ) {
return selector.replace( selectorEscape, "\\$1" );
};
} )()
}
} );
// plugins

21
ui/escape-selector.js Normal file
View File

@ -0,0 +1,21 @@
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
// Internal use only
return $.ui.escapeSelector = ( function() {
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
return function( selector ) {
return selector.replace( selectorEscape, "\\$1" );
};
} )();
} ) );

View File

@ -24,6 +24,7 @@
"jquery",
"./core",
"./version",
"./escape-selector",
"./widget",
"./position",
"./menu"

View File

@ -23,6 +23,7 @@
define( [
"jquery",
"./core",
"./escape-selector",
"./version",
"./widget"
], factory );