From: Alexander Schmitz Date: Thu, 16 Jul 2015 13:13:15 +0000 (-0400) Subject: Core: Move escape selector into its own module X-Git-Tag: 1.12.0-beta.1~226 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=47188b792617a0030ccec07c6df27335dc3aa430;p=jquery-ui.git Core: Move escape selector into its own module Ref #9647 --- diff --git a/ui/core.js b/ui/core.js index a0931dffa..fe627dea6 100644 --- a/ui/core.js +++ b/ui/core.js @@ -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 diff --git a/ui/escape-selector.js b/ui/escape-selector.js new file mode 100644 index 000000000..d43e4f816 --- /dev/null +++ b/ui/escape-selector.js @@ -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" ); + }; +} )(); + +} ) ); diff --git a/ui/selectmenu.js b/ui/selectmenu.js index 227d87ae7..fe1a7fa99 100644 --- a/ui/selectmenu.js +++ b/ui/selectmenu.js @@ -24,6 +24,7 @@ "jquery", "./core", "./version", + "./escape-selector", "./widget", "./position", "./menu" diff --git a/ui/tabs.js b/ui/tabs.js index 5aaa8c5fa..4cd80a1df 100644 --- a/ui/tabs.js +++ b/ui/tabs.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./escape-selector", "./version", "./widget" ], factory );