CSS: isHidden -> isHiddenWithinTree

Fixes gh-2404
Close gh-2855
This commit is contained in:
Timmy Willison 2016-01-20 13:20:58 -05:00
parent 4d3050b3d8
commit a6fc0b1651
4 changed files with 11 additions and 10 deletions

View File

@ -7,7 +7,6 @@ define( [
"./var/rcssNum", "./var/rcssNum",
"./css/var/rnumnonpx", "./css/var/rnumnonpx",
"./css/var/cssExpand", "./css/var/cssExpand",
"./css/var/isHidden",
"./css/var/getStyles", "./css/var/getStyles",
"./css/var/swap", "./css/var/swap",
"./css/curCSS", "./css/curCSS",
@ -19,7 +18,7 @@ define( [
"./core/ready", "./core/ready",
"./selector" // contains "./selector" // contains
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand, ], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand,
isHidden, getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) { getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) {
var var

View File

@ -1,8 +1,8 @@
define( [ define( [
"../core", "../core",
"../data/var/dataPriv", "../data/var/dataPriv",
"../css/var/isHidden" "../css/var/isHiddenWithinTree"
], function( jQuery, dataPriv, isHidden ) { ], function( jQuery, dataPriv, isHiddenWithinTree ) {
var defaultDisplayMap = {}; var defaultDisplayMap = {};
@ -95,7 +95,7 @@ jQuery.fn.extend( {
} }
return this.each( function() { return this.each( function() {
if ( isHidden( this ) ) { if ( isHiddenWithinTree( this ) ) {
jQuery( this ).show(); jQuery( this ).show();
} else { } else {
jQuery( this ).hide(); jQuery( this ).hide();

View File

@ -5,9 +5,11 @@ define( [
// css is assumed // css is assumed
], function( jQuery ) { ], function( jQuery ) {
// This function differs from the :hidden selector
// in that it intentionally ignores hidden ancestors (gh-2404)
return function( elem, el ) { return function( elem, el ) {
// isHidden might be called from jQuery#filter function; // isHiddenWithinTree might be called from jQuery#filter function;
// in that case, element will be second argument // in that case, element will be second argument
elem = el || elem; elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || return jQuery.css( elem, "display" ) === "none" ||

8
src/effects.js vendored
View File

@ -4,7 +4,7 @@ define( [
"./var/rcssNum", "./var/rcssNum",
"./var/rnotwhite", "./var/rnotwhite",
"./css/var/cssExpand", "./css/var/cssExpand",
"./css/var/isHidden", "./css/var/isHiddenWithinTree",
"./css/var/swap", "./css/var/swap",
"./css/adjustCSS", "./css/adjustCSS",
"./data/var/dataPriv", "./data/var/dataPriv",
@ -17,7 +17,7 @@ define( [
"./manipulation", "./manipulation",
"./css", "./css",
"./effects/Tween" "./effects/Tween"
], function( jQuery, document, rcssNum, rnotwhite, cssExpand, isHidden, swap, ], function( jQuery, document, rcssNum, rnotwhite, cssExpand, isHiddenWithinTree, swap,
adjustCSS, dataPriv, showHide ) { adjustCSS, dataPriv, showHide ) {
var var
@ -82,7 +82,7 @@ function defaultPrefilter( elem, props, opts ) {
anim = this, anim = this,
orig = {}, orig = {},
style = elem.style, style = elem.style,
hidden = elem.nodeType && isHidden( elem ), hidden = elem.nodeType && isHiddenWithinTree( elem ),
dataShow = dataPriv.get( elem, "fxshow" ); dataShow = dataPriv.get( elem, "fxshow" );
// Queue-skipping animations hijack the fx hooks // Queue-skipping animations hijack the fx hooks
@ -479,7 +479,7 @@ jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) { fadeTo: function( speed, to, easing, callback ) {
// Show any hidden elements after setting opacity to 0 // Show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show() return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
// Animate to the value specified // Animate to the value specified
.end().animate( { opacity: to }, speed, easing, callback ); .end().animate( { opacity: to }, speed, easing, callback );