A lot of native HTMLElement implementations are still missing in our fork of deno_dom.
The missing elements can be found in deno-dom/src/dom/types/tags.ts (all class names that are commented out).
To implement a new HTMLElement sub class (e.g. HTMLXElement), follow these steps (the order is important):
- Make sure you have the latest version of uix with all submodules (uix-dom, deno_dom) recursively loaded
- Create a new file called
html-x-element.ts in deno-dom/src/dom/html-elements
- Create a class that extends
HTMLElement and add the required additional properties and methods following the HTML spec
import { HTMLElement } from "../elements/html-element.ts";
export class HTMLXElement extends HTMLElement {
// custom implementation ...
}
- Export the newly created file from src/api.ts:
export * from "./dom/html-elements/html-x-element.ts"
- Add the correct type to deno-dom/src/dom/types/tags.ts (remove the element type that is commented out):
import { HTMLXElement } from "../html-elements/html-x-element.ts";
export interface HTMLElementTagNameMap {
"x": HTMLXElement
}
- Add an element tag name mapping in uix-dom/dom/mod.ts
elements.define("X", denoDom.HTMLXElement)
- Add a global type definition in uix/src/app/dom-global.ts:
const HTMLInputElement: typeof api.HTMLXElement
type HTMLInputElement = api.HTMLXElement
A lot of native HTMLElement implementations are still missing in our fork of deno_dom.
The missing elements can be found in deno-dom/src/dom/types/tags.ts (all class names that are commented out).
To implement a new HTMLElement sub class (e.g.
HTMLXElement), follow these steps (the order is important):html-x-element.tsin deno-dom/src/dom/html-elementsHTMLElementand add the required additional properties and methods following the HTML spec