mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Core: Re-ordered functions.
This commit is contained in:
parent
dd035d1123
commit
a3d9a91661
133
ui/jquery.ui.core.js
vendored
133
ui/jquery.ui.core.js
vendored
@ -17,72 +17,9 @@ if ( $.ui.version ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Helper functions and ui object
|
|
||||||
$.extend( $.ui, {
|
$.extend( $.ui, {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
|
|
||||||
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
|
||||||
plugin: {
|
|
||||||
add: function( module, option, set ) {
|
|
||||||
var proto = $.ui[ module ].prototype;
|
|
||||||
for ( var i in set ) {
|
|
||||||
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
|
||||||
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
call: function( instance, name, args ) {
|
|
||||||
var set = instance.plugins[ name ];
|
|
||||||
if ( !set || !instance.element[ 0 ].parentNode ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( var i = 0; i < set.length; i++ ) {
|
|
||||||
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
|
||||||
set[ i ][ 1 ].apply( instance.element, args );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
contains: function( a, b ) {
|
|
||||||
return document.compareDocumentPosition ?
|
|
||||||
a.compareDocumentPosition( b ) & 16 :
|
|
||||||
a !== b && a.contains( b );
|
|
||||||
},
|
|
||||||
|
|
||||||
hasScroll: function( el, a ) {
|
|
||||||
|
|
||||||
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
|
||||||
if ( $( el ).css( "overflow" ) === "hidden") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
|
||||||
has = false;
|
|
||||||
|
|
||||||
if ( el[ scroll ] > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: determine which cases actually cause this to happen
|
|
||||||
// if the element doesn't have the scroll set, see if it's possible to
|
|
||||||
// set the scroll
|
|
||||||
el[ scroll ] = 1;
|
|
||||||
has = ( el[ scroll ] > 0 );
|
|
||||||
el[ scroll ] = 0;
|
|
||||||
return has;
|
|
||||||
},
|
|
||||||
|
|
||||||
isOverAxis: function( x, reference, size ) {
|
|
||||||
//Determines when x coordinate is over "b" element axis
|
|
||||||
return ( x > reference ) && ( x < ( reference + size ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
isOver: function( y, x, top, left, height, width ) {
|
|
||||||
//Determines when x, y coordinates is over "b" element
|
|
||||||
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
|
||||||
},
|
|
||||||
|
|
||||||
keyCode: {
|
keyCode: {
|
||||||
ALT: 18,
|
ALT: 18,
|
||||||
BACKSPACE: 8,
|
BACKSPACE: 8,
|
||||||
@ -278,4 +215,74 @@ $.extend( $.expr[ ":" ], {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$.extend( $.ui, {
|
||||||
|
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
||||||
|
plugin: {
|
||||||
|
add: function( module, option, set ) {
|
||||||
|
var proto = $.ui[ module ].prototype;
|
||||||
|
for ( var i in set ) {
|
||||||
|
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
||||||
|
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
call: function( instance, name, args ) {
|
||||||
|
var set = instance.plugins[ name ];
|
||||||
|
if ( !set || !instance.element[ 0 ].parentNode ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0; i < set.length; i++ ) {
|
||||||
|
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
||||||
|
set[ i ][ 1 ].apply( instance.element, args );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
|
||||||
|
contains: function( a, b ) {
|
||||||
|
return document.compareDocumentPosition ?
|
||||||
|
a.compareDocumentPosition( b ) & 16 :
|
||||||
|
a !== b && a.contains( b );
|
||||||
|
},
|
||||||
|
|
||||||
|
// only used by resizable
|
||||||
|
hasScroll: function( el, a ) {
|
||||||
|
|
||||||
|
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
||||||
|
if ( $( el ).css( "overflow" ) === "hidden") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
||||||
|
has = false;
|
||||||
|
|
||||||
|
if ( el[ scroll ] > 0 ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: determine which cases actually cause this to happen
|
||||||
|
// if the element doesn't have the scroll set, see if it's possible to
|
||||||
|
// set the scroll
|
||||||
|
el[ scroll ] = 1;
|
||||||
|
has = ( el[ scroll ] > 0 );
|
||||||
|
el[ scroll ] = 0;
|
||||||
|
return has;
|
||||||
|
},
|
||||||
|
|
||||||
|
// these are odd functions, fix the API or move into individual plugins
|
||||||
|
isOverAxis: function( x, reference, size ) {
|
||||||
|
//Determines when x coordinate is over "b" element axis
|
||||||
|
return ( x > reference ) && ( x < ( reference + size ) );
|
||||||
|
},
|
||||||
|
isOver: function( y, x, top, left, height, width ) {
|
||||||
|
//Determines when x, y coordinates is over "b" element
|
||||||
|
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
Loading…
Reference in New Issue
Block a user