Skip to main content

Bug Tracker

Side navigation

Ticket #4512: 4512.diff
File 4512.diff, 0.9 KB (added by brandon, May 18, 2009 01:50PM UTC)
Index: src/selector.js
===================================================================
--- src/selector.js	(revision 6350)
+++ src/selector.js	(working copy)
@@ -977,11 +977,21 @@
 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){

Download in other formats:

Original Format