X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fselector.js;h=5bde726ecf10cb66b3c21eb840801b82121502d7;hb=b97b886fcd212b7a4c8c883b1afb04b6bd071545;hp=b404064a98e2df010f95ed34e6b3976256646b65;hpb=e10e625bf4865cb8e9927e94d15afa37f6537a03;p=jquery.git diff --git a/src/selector.js b/src/selector.js index b404064..5bde726 100644 --- a/src/selector.js +++ b/src/selector.js @@ -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){