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.

This commit is contained in:
John Resig 2009-02-16 15:52:15 +00:00
parent 5586fedf29
commit e25c4a132f
2 changed files with 8 additions and 9 deletions

View file

@ -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){