LibWeb: Implement scoped custom element registries

This commit is contained in:
Sam Atkins
2026-02-27 17:05:47 +00:00
committed by Tim Ledbetter
parent 90c39c214d
commit ed6a5f25a0
Notes: github-actions[bot] 2026-03-27 19:50:58 +00:00
48 changed files with 1243 additions and 749 deletions

View File

@@ -18,15 +18,18 @@ function getElementByShadowIds(root, ids) {
// Installs a mininal custom element based on this template.
function installCustomElement(element_name, template_id) {
console.log(`install custom element '${element_name}' to ${window.customElements}`);
ceClass = class extends HTMLElement {
constructor() {
super();
console.log(`Constructor for ${element_name}`);
var template = document
.getElementById(template_id)
.content;
this
.attachShadow({mode: 'open'})
.appendChild(template.cloneNode(true));
console.log(`End constructor for ${element_name}`);
}
};
window.customElements.define(element_name, ceClass);