Skip to content

Commit

Permalink
fix(components): TranscludingComponentFactory passes a wrong element …
Browse files Browse the repository at this point in the history
…to onShadowRoot

Closes dart-archive#1435
  • Loading branch information
vsavkin committed Sep 8, 2014
1 parent f14cc71 commit 20ef6b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/core_dom/transcluding_component_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {
var childInjectorCompleter; // Used if the ViewFuture is available before the childInjector.

var component = _component;
var lightDom = new LightDom(element, scope);
final shadowRoot = new EmulatedShadowRoot(element);
final lightDom = new LightDom(element, scope);

// Append the component's template as children
var elementFuture;
Expand All @@ -64,12 +65,12 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {

if (childInjector != null) {
lightDom.shadowDomView = viewFactory.call(childInjector.scope, childInjector);
return element;
return shadowRoot;
} else {
childInjectorCompleter = new async.Completer();
return childInjectorCompleter.future.then((childInjector) {
lightDom.shadowDomView = viewFactory.call(childInjector.scope, childInjector);
return element;
return shadowRoot;
});
}
});
Expand All @@ -81,7 +82,7 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {
Scope shadowScope = scope.createChild(new HashMap());

childInjector = new ComponentDirectiveInjector(injector, this._injector,
eventHandler, shadowScope, templateLoader, new EmulatedShadowRoot(element), lightDom, view);
eventHandler, shadowScope, templateLoader, shadowRoot, lightDom, view);

childInjector.bindByKey(_ref.typeKey, _ref.factory, _ref.paramKeys, _ref.annotation.visibility);

Expand Down
2 changes: 1 addition & 1 deletion test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ class AttachDetachComponent implements AttachAware, DetachAware, ShadowRootAware

attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
detach() => logger('detach');
onShadowRoot(shadowRoot) {
onShadowRoot(ShadowRoot shadowRoot) {
scope.rootScope.context['shadowRoot'] = shadowRoot;
logger(shadowRoot);
}
Expand Down

0 comments on commit 20ef6b0

Please sign in to comment.