This release adds the support of specifying options
of document.createElement
or document.createElementNS
in props
argument of tag functions.
Below is an example of using this feature to create a custom button
element:
const {button} = van.tags
class MyButton extends HTMLButtonElement {
connectedCallback() {
this.addEventListener("click", () => alert("MyButton clicked!"))
}
}
customElements.define("my-button", MyButton, {extends: "button"})
const CustomButton = () => button({is: "my-button"}, "Click me")
van.add(document.body, CustomButton())
See the release announcement: #290 (comment)