diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2016-04-14 13:45:54 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-05-11 18:24:00 -0400 |
commit | c43066c41ec84ac5e5fe7fb3e6cd3a912a395140 (patch) | |
tree | 599b09524a5fd8440e8d1b3ea01e7c002859a017 /src | |
parent | 59003ae7132677023247ed1868e4e426e4c2fe81 (diff) | |
download | jquery-c43066c41ec84ac5e5fe7fb3e6cd3a912a395140.tar.gz jquery-c43066c41ec84ac5e5fe7fb3e6cd3a912a395140.zip |
CSS: disconnected elements should be hidden
Fixes gh-3043
Diffstat (limited to 'src')
-rw-r--r-- | src/css/hiddenVisibleSelectors.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index 899b9eca4..e75ff5fc3 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -1,15 +1,21 @@ define( [ "../core", + "../var/document", "./support", "../selector", "../css" -], function( jQuery, support ) { +], function( jQuery, document, support ) { function getDisplay( elem ) { return elem.style && elem.style.display || jQuery.css( elem, "display" ); } function filterHidden( elem ) { + + // Disconnected elements are considered hidden + if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) { + return true; + } while ( elem && elem.nodeType === 1 ) { if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) { return true; |