mirror of
https://github.com/jquery/jquery.git
synced 2026-02-15 10:45:08 -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:
@@ -6,15 +6,13 @@ define([
|
||||
], function( jQuery, support ) {
|
||||
|
||||
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 ||
|
||||
(!support.reliableHiddenOffsets() &&
|
||||
((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
|
||||
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 ) &&
|
||||
( support.reliableHiddenOffsets() ||
|
||||
( ( elem.style && elem.style.display ) || jQuery.css( elem, "display" ) ) !== "none" );
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user