Commit b97b886f authored by Brandon Aaron's avatar Brandon Aaron

fix :hidden and :visible selectors. fixes #4512

parent e10e625b
...@@ -977,11 +977,21 @@ jQuery.expr = Sizzle.selectors; ...@@ -977,11 +977,21 @@ jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters; jQuery.expr[":"] = jQuery.expr.filters;
Sizzle.selectors.filters.hidden = function(elem){ Sizzle.selectors.filters.hidden = function(elem){
return elem.offsetWidth === 0 && elem.offsetHeight === 0; var width = elem.offsetWidth, height = elem.offsetHeight;
return ( width === 0 && height === 0 ) ?
true :
( width !== 0 && height !== 0 ) ?
false :
!!( jQuery.curCSS(elem, "display") === "none" );
}; };
Sizzle.selectors.filters.visible = function(elem){ Sizzle.selectors.filters.visible = function(elem){
return elem.offsetWidth > 0 || elem.offsetHeight > 0; var width = elem.offsetWidth, height = elem.offsetHeight;
return ( width === 0 && height === 0 ) ?
false :
( width > 0 && height > 0 ) ?
true :
!!( jQuery.curCSS(elem, "display") !== "none" );
}; };
Sizzle.selectors.filters.animated = function(elem){ Sizzle.selectors.filters.animated = function(elem){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment