Top
Best
New

Posted by todsacerdoti 12/29/2025

You can make up HTML tags(maurycyz.com)
584 points | 190 commentspage 5
mg 12/29/2025|
My problem with custom tags is that they require a hyphen, and that makes it impossible to have consistency between tag names and variable names.

With classes, I can do:

    carList = document.querySelector('.carList')
With custom tags, that is not possible because variable names cannot have hyphens in them.
tannhaeuser 12/29/2025||
Worth noting you can't define special parsing rules using custom elements, such as for inferring omitted tags like is done for predefined elements all the time. The behavior of parsing HTML fragments with customized standard elements using the browser API is basically underspecified since it lacks a context element which however is needed for inferring required omitted elements such as <head> and <body>, or <html> itself. What about custom elements appearing as child content of other custom elements?

For merely defining custom elements you need JS anyway, so these aren't a technique intended for text authors. Yet as another way to organize code in webapps, custom elements are competing with JS which already has multiple module and namespace and OO import features that are much more flexible.

So as usual, random people on github (aka WHAT working group individuals aka Google shills) reinventing SGML, poorly. Because why not? The end goal always has been to make ad blocking an infeasible arms race and gather "telemetry."

cheeaun 12/29/2025||
Many years ago, IE requires `document.createElement`.

HTML5 Shiv was needed, with added history https://www.paulirish.com/2011/the-history-of-the-html5-shiv... (2011)

system2 12/29/2025||
I will refuse this idea until it is widely known, accepted, and used by everyone. Div with class is easier to inspect and modify with pseudo. I wonder what would happen with JS getting the element with this, too.
cubefox 12/29/2025||
I was forced to use this years ago because there is only a :nth-of-type selector, but no :nth-of-class. So whenever you need nth-of-class, switch to made-up tags and use nth-of-type. (A tag is a type.)
senfiaj 12/29/2025|
There is N-th child selector with filter, for example you can write :nth-child(3 of .red)

https://waspdev.com/articles/2025-06-29/css-features-web-dev...

cubefox 12/29/2025||
Cool! I guess this now also makes nth-of-type superfluous.
senfiaj 12/29/2025||
IMHO this also makes custom tags no longer very useful beyond custom HTML components (JS is also required for that). The standard tags provide good semantics, SEO and accessibility out of the box.
pwmglenn 12/29/2025||
There is a CSS library that utilizes this behavior: https://github.com/doeixd/CSS-Tags
chrisrickard 12/29/2025||
Also, probably a good way to give LLMs more context compared to “div soup”
j3s 12/29/2025||
I find that deviating from standards has ways of triggering growing pains.
orliesaurus 12/29/2025|
If this works, then the point of having standards, is just for screen readers??
More comments...