Skip to content
Snippets Groups Projects

app-shell: Support the new scoped elements registry polyfill

Merged Reiter, Christoph requested to merge app-shell-scoped-polyfill into master
1 file
+ 13
1
Compare changes
  • Side-by-side
  • Inline
@@ -729,7 +729,19 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
@@ -729,7 +729,19 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
this.track('renderActivity', activity.element);
this.track('renderActivity', activity.element);
const elm = document.createElement(activity.element);
// After it is loaded and registered globally, we get it and register it locally
 
customElements.whenDefined(activity.element).then(() => {
 
this.defineScopedElement(activity.element, customElements.get(activity.element));
 
});
 
 
// In case of "Scoped Custom Element Registries" polyfill we create a scoped element
 
let elm;
 
if (this.shadowRoot.createElement !== undefined) {
 
elm = this.shadowRoot.createElement(activity.element);
 
} else {
 
elm = document.createElement(activity.element);
 
}
 
this._onActivityAdded(elm);
this._onActivityAdded(elm);
this._lastElm = elm;
this._lastElm = elm;
return elm;
return elm;
Loading