aboutsummaryrefslogtreecommitdiffstats
path: root/src/css
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-05-08 15:27:54 -0700
committerTimmy Willison <timmywillisn@gmail.com>2015-05-12 09:14:16 -0400
commit79bcb291324167ab2d844027d0cdc6300613d010 (patch)
treefd4380cbc061c86247a9acca910fa66d8eaf8023 /src/css
parent7855a1a7d8a5c959d4ef2f951b4eb971908ac96f (diff)
downloadjquery-79bcb291324167ab2d844027d0cdc6300613d010.tar.gz
jquery-79bcb291324167ab2d844027d0cdc6300613d010.zip
CSS: fix :visible/:hidden selectors for inline element w/ content
- Reverts behavior from 10399dd, which we never released. BR and inline elements are considered visible. - The possibility of dropping .offsetWidth and .offsetHeight was debunked by this perf: http://jsperf.com/visible-hidden-and-getclientrects Fixes gh-2227 Close gh-2281
Diffstat (limited to 'src/css')
-rw-r--r--src/css/hiddenVisibleSelectors.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js
index 01ecc3396..b4d7482e8 100644
--- a/src/css/hiddenVisibleSelectors.js
+++ b/src/css/hiddenVisibleSelectors.js
@@ -4,12 +4,10 @@ define([
], function( jQuery ) {
jQuery.expr.filters.hidden = function( elem ) {
- // Use OR instead of AND as the element is not visible if either is true
- // See tickets #10406 and #13132
- return !elem.offsetWidth || !elem.offsetHeight;
+ return !jQuery.expr.filters.visible( elem );
};
jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
+ return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};
});