mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 00:08:17 -05:00
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
This commit is contained in:
@@ -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 );
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user