Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix :hidden and :visible selectors. fixes #4512
  • Loading branch information
brandonaaron committed May 18, 2009
1 parent e10e625 commit b97b886
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/selector.js
Expand Up @@ -977,11 +977,21 @@ jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;

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){
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){
Expand Down

0 comments on commit b97b886

Please sign in to comment.