File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 52
52
Polymer . dom . flush ( ) ;
53
53
} ,
54
54
55
+ /**
56
+ * Check that the given node is a descendant of `this`,
57
+ * ignoring ShadowDOM boundaries
58
+ * @param {Node } node
59
+ * @return {Boolean } true if `node` is a descendant or equal to `this`
60
+ */
61
+ deepContains : function ( node ) {
62
+ // fast path, use shallow `contains`.
63
+ if ( this . node . contains ( node ) ) {
64
+ return true ;
65
+ }
66
+ var n = node ;
67
+ // wrap document for SD polyfill
68
+ var wrappedDocument = wrap ( document ) ;
69
+ // walk from node to `this` or `document`
70
+ while ( n && n !== wrappedDocument && n !== this . node ) {
71
+ // use logical parentnode, or native ShadowRoot host
72
+ n = Polymer . dom ( n ) . parentNode || n . host ;
73
+ }
74
+ return n === this . node ;
75
+ } ,
76
+
55
77
_lazyDistribute : function ( host ) {
56
78
// note: only try to distribute if the root is not clean; this ensures
57
79
// we don't distribute before initial distribution
You can’t perform that action at this time.
0 commit comments