• m_‮fOPMA
    link
    fedilink
    English
    arrow-up
    8
    ·
    2 months ago

    I was aware that HTML is pretty loose with tags, but didn’t realize that tags with hyphens in the name are explicitly reserved for custom elements:

    https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name

    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).

    Since the web has some messy history there’s a few tag names already with hyphens in the names, hence the “going forward”. There’s some more interesting tidbits over in the HN comments, like the CSS :defined selector, which targets standard elements, and custom elements that have been registered in JS with CustomElementRegistry.define()