Permalink
Browse files

Core: Move plugin into its own module

Ref #9647
  • Loading branch information...
arschmitz committed Jul 15, 2015
1 parent 2d03e12 commit 0a9df3af52a66fe5e8f23622503020f0bcc6ded9
Showing with 46 additions and 31 deletions.
  1. +1 −30 ui/core.js
  2. +1 −0 ui/draggable.js
  3. +43 −0 ui/plugin.js
  4. +1 −1 ui/resizable.js
View
@@ -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 );
}
}
}
};
} ) );
View
@@ -23,6 +23,7 @@
"./core",
"./data",
"./mouse",
"./plugin",
"./version",
"./widget"
], factory );
View
@@ -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 );
}
}
}
};
} ) );
View
@@ -22,9 +22,9 @@
// AMD. Register as an anonymous module.
define([
"jquery",
"./core",
"./disable-selection",
"./mouse",
"./plugin",
"./version",
"./widget"
], factory );

0 comments on commit 0a9df3a

Please sign in to comment.