mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-21 01:57:06 +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:
@@ -168,6 +168,19 @@ describe('jqLite', function() {
|
||||
|
||||
dealoc(ul);
|
||||
});
|
||||
|
||||
it('should pass through DocumentFragment boundaries via host', function() {
|
||||
var host = jqLite('<div></div>'),
|
||||
frag = document.createDocumentFragment(),
|
||||
$frag = jqLite(frag);
|
||||
frag.host = host[0];
|
||||
host.data("foo", 123);
|
||||
host.append($frag);
|
||||
expect($frag.inheritedData("foo")).toBe(123);
|
||||
|
||||
dealoc(host);
|
||||
dealoc($frag);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user