mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb: Implement scoped custom element registries
This commit is contained in:
committed by
Tim Ledbetter
parent
90c39c214d
commit
ed6a5f25a0
Notes:
github-actions[bot]
2026-03-27 19:50:58 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/ed6a5f25a0a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8613 Reviewed-by: https://github.com/tcl3 ✅
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user