diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2009-05-18 15:36:36 +0000 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2009-05-18 15:36:36 +0000 |
commit | b97b886fcd212b7a4c8c883b1afb04b6bd071545 (patch) | |
tree | 7503bc94c8f4be69626af0883775451f8f96ba56 /src/selector.js | |
parent | e10e625bf4865cb8e9927e94d15afa37f6537a03 (diff) | |
download | jquery-b97b886fcd212b7a4c8c883b1afb04b6bd071545.tar.gz jquery-b97b886fcd212b7a4c8c883b1afb04b6bd071545.zip |
fix :hidden and :visible selectors. fixes #4512
Diffstat (limited to 'src/selector.js')
-rw-r--r-- | src/selector.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/selector.js b/src/selector.js index b404064a9..5bde726ec 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){ |