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

View File

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