aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorCaitlin Potter2014-03-10 19:32:09 -0400
committerCaitlin Potter2014-03-17 16:52:48 -0400
commit8a96f317e594a5096d4fa56ceae4c685eec8ac8b (patch)
tree80dd7a2c8f8df40d954ad07652f21278dd7b598e /src/jqLite.js
parentd3aa14bc11ef26587f88d3e3abf52fae3bad964a (diff)
downloadangular.js-8a96f317e594a5096d4fa56ceae4c685eec8ac8b.tar.bz2
fix(jqLite): traverse `host` property for DocumentFragment in inheritedData()
If dealing with a document fragment node with a host element, and no parent, use the host element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM to lookup parent controllers. Closes #6637
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index ba613f21..738f47a9 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -364,11 +364,15 @@ function jqLiteInheritedData(element, name, value) {
var names = isArray(name) ? name : [name];
while (element.length) {
-
+ var node = element[0];
for (var i = 0, ii = names.length; i < ii; i++) {
if ((value = element.data(names[i])) !== undefined) return value;
}
- element = element.parent();
+
+ // If dealing with a document fragment node with a host element, and no parent, use the host
+ // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+ // to lookup parent controllers.
+ element = jqLite(node.parentNode || (node.nodeType === 11 && node.host));
}
}