Using own custom tag directly in HTML document without using document.registerElement('my-tag')
seems to works fine. It can be styled as usual etc.
registerElement has two advantages:
var myTag = document.registerElement("my-tag");
document.body.appendChild(new myTag())
var customImg = document.registerElement("custom-img", { prototype: Object.create(HTMLImageElement.prototype) });
The second one is actually a general options object where an additional prototype can be extended or an existing tag be extended (like <img is="custom-img">)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With