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

View File

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

View File

@ -5,9 +5,11 @@ define( [
// css is assumed
], function( jQuery ) {
// This function differs from the :hidden selector
// in that it intentionally ignores hidden ancestors (gh-2404)
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
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" ||

8
src/effects.js vendored
View File

@ -4,7 +4,7 @@ define( [
"./var/rcssNum",
"./var/rnotwhite",
"./css/var/cssExpand",
"./css/var/isHidden",
"./css/var/isHiddenWithinTree",
"./css/var/swap",
"./css/adjustCSS",
"./data/var/dataPriv",
@ -17,7 +17,7 @@ define( [
"./manipulation",
"./css",
"./effects/Tween"
], function( jQuery, document, rcssNum, rnotwhite, cssExpand, isHidden, swap,
], function( jQuery, document, rcssNum, rnotwhite, cssExpand, isHiddenWithinTree, swap,
adjustCSS, dataPriv, showHide ) {
var
@ -82,7 +82,7 @@ function defaultPrefilter( elem, props, opts ) {
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
hidden = elem.nodeType && isHiddenWithinTree( elem ),
dataShow = dataPriv.get( elem, "fxshow" );
// Queue-skipping animations hijack the fx hooks
@ -479,7 +479,7 @@ jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) {
// 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
.end().animate( { opacity: to }, speed, easing, callback );