mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
44 lines
987 B
JavaScript
44 lines
987 B
JavaScript
|
( 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 );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} ) );
|