-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXCEPTION: type 'ShadowRootImpl' is not a subtype of type 'Element' of 'function #25969
Comments
This is quite painful because without native shadow DOM, CSS is merged into page level styles and nearly impossible to debug. |
Do you have a reproduction? Where does ShadowRootImpl come from? I don't see that class anywhere in the SDK or even in a web search. Is it possible that the reason it works in dart2js is just that it's not in checked mode? |
I haven't found anything about |
With the code in this repository https://github.com/bwu-dart/bwu_ng_elements I can reproduce. After Dartium is done loading the application I get the exception without any manual action. When I remove or Then the exception isn't thrown. |
That code seems to depend on the non-available bwu_sass_transformer. Presumably ViewEncapsulation.Native is telling it to use the native Shadow DOM. But that doesn't explain where ShadowRootImpl is coming from. It's not in Angular, and the only places I found it are in C++, which I doubt is what we're seeing. Basically, someone somewhere has a ShadowRootImpl which is not an element, and in Angular's BrowserDOMAdapter they declare parentElement as returning an element when it can in fact return the ShadowRootImpl. The subclassing makes sense. In Dart ShadowRoot extends DocumentFragment, which extends Node. So
is wrong. It might reasonably return null if the parentNode is not an Element. |
Ups sorry, missed that one. |
This exception seems similar
which is caused by this unused import |
Yes, this seems like Angular is doing some messing around. That file defines EventListener. Is that Shadowing the dart:html implementation and substituting debug/mock classes. Somehow or other Angular is playing games and returning types that don't match. Did this work in older Dartium? Does it work in dart2js compiled in checked mode? |
I basically just started with Angular2, therefore I can't tell about older Dartium. I wasn't aware that such a messing-around is even possible. I'll try in checked mode dart2js and report back. |
I think these two issues are somewhat different. The shadow root one seems like a bug in Angular where it assumes the parent of an element is also an element, which is not true. The second one seems like it's returning something entirely incorrect, giving back some sort of element when a String is expected. |
I added - $dart2js:
checked: true I can't reproduce the error with this build output in Chrome. |
I'll going to close this. Didn't run into that since months. |
This works fine in Chrome Version 49.0.2623.75 beta (64-bit)
but fails in Dartium Version 45.0.2454.0 (64-bit)
Dart VM version: 1.16.0-edge.6f6b345f751f14f61d348b3ea53df35828effe71 (Wed Mar 9 15:34:20 2016) on "linux_x64"
I have a few simple Angular components with
encapsulation: ViewEncapsulation.Native
and<ng-content></ng-content>
inside a component withencapsulation: ViewEncapsulation.Emulated
.When I changed all elements to
encapsulation: ViewEncapsulation.Emulated
the exception didn't occur anymore.The text was updated successfully, but these errors were encountered: