diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-07-15 18:31:39 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-08 00:29:36 -0400 |
commit | 0a9df3af52a66fe5e8f23622503020f0bcc6ded9 (patch) | |
tree | a70be2ab4a4322c6e1d423353b6ae0c5f5e1d1f1 /ui | |
parent | 2d03e1280a3671468aba6d48d60ba9381fe90e19 (diff) | |
download | jquery-ui-0a9df3af52a66fe5e8f23622503020f0bcc6ded9.tar.gz jquery-ui-0a9df3af52a66fe5e8f23622503020f0bcc6ded9.zip |
Core: Move plugin into its own module
Ref #9647
Diffstat (limited to 'ui')
-rw-r--r-- | ui/core.js | 31 | ||||
-rw-r--r-- | ui/draggable.js | 1 | ||||
-rw-r--r-- | ui/plugin.js | 43 | ||||
-rw-r--r-- | ui/resizable.js | 2 |
4 files changed, 46 insertions, 31 deletions
diff --git a/ui/core.js b/ui/core.js index 7771c74ee..beb3fcbcb 100644 --- a/ui/core.js +++ b/ui/core.js @@ -28,6 +28,7 @@ "./keycode", "./labels", "./jquery-1-7", + "./plugin", "./version" ], factory ); } else { @@ -125,34 +126,4 @@ $.extend( $.expr[ ":" ], { } } ); -// $.ui.plugin is deprecated. Use $.widget() extensions instead. -$.ui.plugin = { - add: function( module, option, set ) { - var i, - proto = $.ui[ module ].prototype; - for ( i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args, allowDisconnected ) { - var i, - set = instance.plugins[ name ]; - - if ( !set ) { - return; - } - - if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { - return; - } - - for ( i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } -}; - } ) ); diff --git a/ui/draggable.js b/ui/draggable.js index 47855e157..81cb7d6de 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -23,6 +23,7 @@ "./core", "./data", "./mouse", + "./plugin", "./version", "./widget" ], factory ); diff --git a/ui/plugin.js b/ui/plugin.js new file mode 100644 index 000000000..0f1d9b040 --- /dev/null +++ b/ui/plugin.js @@ -0,0 +1,43 @@ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery", "./version" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +} ( function( $ ) { + +// $.ui.plugin is deprecated. Use $.widget() extensions instead. +return $.ui.plugin = { + add: function( module, option, set ) { + var i, + proto = $.ui[ module ].prototype; + for ( i in set ) { + proto.plugins[ i ] = proto.plugins[ i ] || []; + proto.plugins[ i ].push( [ option, set[ i ] ] ); + } + }, + call: function( instance, name, args, allowDisconnected ) { + var i, + set = instance.plugins[ name ]; + + if ( !set ) { + return; + } + + if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { + return; + } + + for ( i = 0; i < set.length; i++ ) { + if ( instance.options[ set[ i ][ 0 ] ] ) { + set[ i ][ 1 ].apply( instance.element, args ); + } + } + } +}; + +} ) ); diff --git a/ui/resizable.js b/ui/resizable.js index 1c0ad6ff1..ca36f2ca2 100644 --- a/ui/resizable.js +++ b/ui/resizable.js @@ -22,9 +22,9 @@ // AMD. Register as an anonymous module. define([ "jquery", - "./core", "./disable-selection", "./mouse", + "./plugin", "./version", "./widget" ], factory ); |