diff options
author | John Resig <jeresig@gmail.com> | 2009-02-16 15:52:15 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-02-16 15:52:15 +0000 |
commit | e25c4a132f9f11cb407605e3ca7d1900ca904077 (patch) | |
tree | b826d0c210cda96f76ace3a743594b96b5226824 /src/selector.js | |
parent | 5586fedf2932dc17b303c860d9f0a7604223f865 (diff) | |
download | jquery-e25c4a132f9f11cb407605e3ca7d1900ca904077.tar.gz jquery-e25c4a132f9f11cb407605e3ca7d1900ca904077.zip |
Change the behavior of how :visible and :hidden work. :hidden is when an element is display none, a parent element is display none, or the element has a width of 0. :visible is when the element is not display none and all of its ancesotrs are not display none and its width is larger than 0. Fixes jQuery bugs #1349, #3265, and #3895.
Diffstat (limited to 'src/selector.js')
-rw-r--r-- | src/selector.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/selector.js b/src/selector.js index 08dee2751..7ad7a8ec0 100644 --- a/src/selector.js +++ b/src/selector.js @@ -937,15 +937,11 @@ jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; Sizzle.selectors.filters.hidden = function(elem){ - return "hidden" === elem.type || - jQuery.css(elem, "display") === "none" || - jQuery.css(elem, "visibility") === "hidden"; + return elem.offsetWidth === 0; }; Sizzle.selectors.filters.visible = function(elem){ - return "hidden" !== elem.type && - jQuery.css(elem, "display") !== "none" && - jQuery.css(elem, "visibility") !== "hidden"; + return elem.offsetWidth > 0; }; Sizzle.selectors.filters.animated = function(elem){ |