aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/var/isHiddenWithinTree.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2016-01-20 13:20:58 -0500
committerTimmy Willison <timmywillisn@gmail.com>2016-01-21 11:27:39 -0500
commita6fc0b16511c70472ebb3dd9469d08566969ac88 (patch)
tree5efd15f7a83651b8f27171b404c3c2bd2f8ec705 /src/css/var/isHiddenWithinTree.js
parent4d3050b3d80dc58cdcca0ce7bfdd780e50b0483f (diff)
downloadjquery-a6fc0b16511c70472ebb3dd9469d08566969ac88.tar.gz
jquery-a6fc0b16511c70472ebb3dd9469d08566969ac88.zip
CSS: isHidden -> isHiddenWithinTree
Fixes gh-2404 Close gh-2855
Diffstat (limited to 'src/css/var/isHiddenWithinTree.js')
-rw-r--r--src/css/var/isHiddenWithinTree.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/css/var/isHiddenWithinTree.js b/src/css/var/isHiddenWithinTree.js
new file mode 100644
index 000000000..1c81f6480
--- /dev/null
+++ b/src/css/var/isHiddenWithinTree.js
@@ -0,0 +1,18 @@
+define( [
+ "../../core",
+ "../../selector"
+
+ // css is assumed
+], function( jQuery ) {
+
+ // This function differs from the :hidden selector
+ // in that it intentionally ignores hidden ancestors (gh-2404)
+ return function( elem, el ) {
+
+ // isHiddenWithinTree might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" ||
+ !jQuery.contains( elem.ownerDocument, elem );
+ };
+} );