mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Core: Removed $.ui.hasScroll(). Fixes #9190 - Core: Remove $.ui.hasScroll().
This commit is contained in:
parent
b26d207d57
commit
ecd6a25a83
62
ui/jquery.ui.core.js
vendored
62
ui/jquery.ui.core.js
vendored
@ -266,55 +266,29 @@ $.fn.extend({
|
||||
}
|
||||
});
|
||||
|
||||
$.extend( $.ui, {
|
||||
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
|
||||
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 ) {
|
||||
var i,
|
||||
set = instance.plugins[ name ];
|
||||
if ( !set || !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 );
|
||||
}
|
||||
}
|
||||
// $.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 ] ] );
|
||||
}
|
||||
},
|
||||
|
||||
// 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;
|
||||
call: function( instance, name, args ) {
|
||||
var i,
|
||||
set = instance.plugins[ name ];
|
||||
if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
||||
has = false;
|
||||
|
||||
if ( el[ scroll ] > 0 ) {
|
||||
return true;
|
||||
for ( i = 0; i < set.length; i++ ) {
|
||||
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
||||
set[ i ][ 1 ].apply( instance.element, args );
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
31
ui/jquery.ui.resizable.js
vendored
31
ui/jquery.ui.resizable.js
vendored
@ -23,6 +23,29 @@ function isNumber(value) {
|
||||
return !isNaN(parseInt(value, 10));
|
||||
}
|
||||
|
||||
function hasScroll( 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;
|
||||
}
|
||||
|
||||
$.widget("ui.resizable", $.ui.mouse, {
|
||||
version: "@VERSION",
|
||||
widgetEventPrefix: "resize",
|
||||
@ -381,7 +404,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
||||
|
||||
pr = this._proportionallyResizeElements;
|
||||
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
|
||||
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
||||
soffseth = ista && hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
||||
soffsetw = ista ? 0 : that.sizeDiff.width;
|
||||
|
||||
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
|
||||
@ -655,7 +678,7 @@ $.ui.plugin.add("resizable", "animate", {
|
||||
o = that.options,
|
||||
pr = that._proportionallyResizeElements,
|
||||
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
||||
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
||||
soffseth = ista && hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
||||
soffsetw = ista ? 0 : that.sizeDiff.width,
|
||||
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
|
||||
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
|
||||
@ -728,8 +751,8 @@ $.ui.plugin.add("resizable", "containment", {
|
||||
co = that.containerOffset;
|
||||
ch = that.containerSize.height;
|
||||
cw = that.containerSize.width;
|
||||
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
|
||||
height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
||||
width = (hasScroll(ce, "left") ? ce.scrollWidth : cw );
|
||||
height = (hasScroll(ce) ? ce.scrollHeight : ch);
|
||||
|
||||
that.parentData = {
|
||||
element: ce, left: co.left, top: co.top, width: width, height: height
|
||||
|
Loading…
Reference in New Issue
Block a user