Skip to content
Snippets Groups Projects
Commit 93f2e80e authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

app-shell: Support the new scoped elements registry polyfill

Register the activity properly and create a scoped element if the API is there.

One all bugs are fixed upstream this should allow us to switch to lit v2
without any further changes.
parent b68b1af5
No related branches found
No related tags found
1 merge request!50app-shell: Support the new scoped elements registry polyfill
Pipeline #26771 passed
...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment