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

View file

@ -46,6 +46,9 @@ export class BetterHTMLElement extends HTMLElement {
}) })
}) })
name = name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase() 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) customElements.define(name, this)
return name return name
} }