Pier Pier - 2 years ago 168
HTML Question

Is it mandatory to use document.registerElement()?

I'm using custom HTML tags such as

for semantic convenience and styling those using CSS. I'm also using the tag name as a selector for jQuery such as

I've removed
from my code, and everything works as expected in Chrome.

Is it mandatory to use
even if I'm not using any Javascript with those custom elements (except for the jQuery selector)?

Answer Source

The only thing registerElement does is allow you to create objects of the new element programmatically via constructor as opposed to by using createElement. This enables you to also add a prototype to the element, or extend an existing element, which AFAIK you can't do with createElement. You don't need to register custom elements if you don't need one of these three things (a constructor, the extension of an existing element, a prototype).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download