3 ms·
This website violates the rule that all custom elements must have a dash in the tag name.
by yoz-y 11mo ago
This website violates the rule that all custom elements must have a dash in the tag name.
- rsstack 11mo agohttps://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name https://html.spec.whatwg.org/multipage/custom-elements.html#... > This is used for namespacing and to ensure forward compatibility (since no elements will be added to HTML, SVG, or MathML with hyphen-containing local names going forward). So things that work today without a dash might break in the future if <badge>, for example, becomes a standard HTML element.
- yoz-y 11mo agoIndeed. And since a lot of web is fire and forget, one day you might get a surprise.
- faboo 11mo agoThat's only a hard requirement if you're creating a web component. Unknown elements are treated as inline elements by default, so if you're just using it for styling and using global attributes (even JS ones like onclick), you can use whatever tags you want. You only run into trouble when you start doing more advanced stuff with your non-standard elements.
- yoz-y 11mo agoYou can still run into problems if the standard one day decides to actually give your custom tag any semantics and default styles.