To define a new HTML control we need the power of CustomElement
IMPORTANT: after defining a CustomElement
, the registerCustomElement
method must be called
with the new class name. only then will the tag defined via the getTag
method be made known to the DOM.
This control uses attachInternals()
to integrate the control into a form.
If the target environment does not support this method, the polyfill can be used.
You can create the object via the function document.createElement()
.
<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
document.createElement('monster-')
</script>