Add option for customized built-in elements

This commit is contained in:
Talia 2021-05-17 17:18:58 +02:00
parent 60af0773a0
commit 137f586400
No known key found for this signature in database
GPG Key ID: AD727AD22802D0D6
1 changed files with 4 additions and 1 deletions

View File

@ -46,6 +46,9 @@ export class BetterHTMLElement extends HTMLElement {
})
})
name = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
if (this.extends)
customElements.define(name, this, { extends: this.extends })
else
customElements.define(name, this)
return name
}