mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-22 10:49:24 +08:00
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
This commit is contained in:
committed by
Vojta Jina
parent
57b0d91fd8
commit
98d825e10d
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user