aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/isAttached.js22
-rw-r--r--src/css/curCSS.js2
-rw-r--r--src/css/var/isHiddenWithinTree.js2
-rw-r--r--src/manipulation.js2
-rw-r--r--src/manipulation/buildFragment.js2
-rw-r--r--src/var/isAttached.js11
6 files changed, 26 insertions, 15 deletions
diff --git a/src/core/isAttached.js b/src/core/isAttached.js
new file mode 100644
index 000000000..efa2465a9
--- /dev/null
+++ b/src/core/isAttached.js
@@ -0,0 +1,22 @@
+define( [
+ "../core",
+ "../var/documentElement",
+ "../selector" // jQuery.contains
+], function( jQuery, documentElement ) {
+ "use strict";
+
+ var isAttached = function( elem ) {
+ return jQuery.contains( elem.ownerDocument, elem );
+ },
+ composed = { composed: true };
+
+ // Check attachment across shadow DOM boundaries when possible (gh-3504)
+ if ( documentElement.attachShadow ) {
+ isAttached = function( elem ) {
+ return jQuery.contains( elem.ownerDocument, elem ) ||
+ elem.getRootNode( composed ) === elem.ownerDocument;
+ };
+ }
+
+ return isAttached;
+} );
diff --git a/src/css/curCSS.js b/src/css/curCSS.js
index 7fed20f17..98a594a77 100644
--- a/src/css/curCSS.js
+++ b/src/css/curCSS.js
@@ -1,6 +1,6 @@
define( [
"../core",
- "../var/isAttached",
+ "../core/isAttached",
"./var/rboxStyle",
"./var/rnumnonpx",
"./var/getStyles",
diff --git a/src/css/var/isHiddenWithinTree.js b/src/css/var/isHiddenWithinTree.js
index fd963a031..0ab610e29 100644
--- a/src/css/var/isHiddenWithinTree.js
+++ b/src/css/var/isHiddenWithinTree.js
@@ -1,6 +1,6 @@
define( [
"../../core",
- "../../var/isAttached"
+ "../../core/isAttached"
// css is assumed
], function( jQuery, isAttached ) {
diff --git a/src/manipulation.js b/src/manipulation.js
index 3c6d59262..a0e93f7ef 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -1,6 +1,6 @@
define( [
"./core",
- "./var/isAttached",
+ "./core/isAttached",
"./var/concat",
"./var/isFunction",
"./var/push",
diff --git a/src/manipulation/buildFragment.js b/src/manipulation/buildFragment.js
index 34bcc70c2..40c2ed1dc 100644
--- a/src/manipulation/buildFragment.js
+++ b/src/manipulation/buildFragment.js
@@ -1,7 +1,7 @@
define( [
"../core",
"../core/toType",
- "../var/isAttached",
+ "../core/isAttached",
"./var/rtagName",
"./var/rscriptType",
"./wrapMap",
diff --git a/src/var/isAttached.js b/src/var/isAttached.js
deleted file mode 100644
index 1dd798268..000000000
--- a/src/var/isAttached.js
+++ /dev/null
@@ -1,11 +0,0 @@
-define( [
- "../core",
- "../selector" // Get jQuery.contains
-], function( jQuery ) {
- "use strict";
-
- return function isAttached( obj ) {
- return jQuery.contains( obj.ownerDocument, obj );
- };
-
-} );