aboutsummaryrefslogtreecommitdiffstats
path: root/ui/plugin.js
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-07-15 18:31:39 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-08-08 00:29:36 -0400
commit0a9df3af52a66fe5e8f23622503020f0bcc6ded9 (patch)
treea70be2ab4a4322c6e1d423353b6ae0c5f5e1d1f1 /ui/plugin.js
parent2d03e1280a3671468aba6d48d60ba9381fe90e19 (diff)
downloadjquery-ui-0a9df3af52a66fe5e8f23622503020f0bcc6ded9.tar.gz
jquery-ui-0a9df3af52a66fe5e8f23622503020f0bcc6ded9.zip
Core: Move plugin into its own module
Ref #9647
Diffstat (limited to 'ui/plugin.js')
-rw-r--r--ui/plugin.js43
1 files changed, 43 insertions, 0 deletions
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 );
+ }
+ }
+ }
+};
+
+} ) );