Comment

Comment by notriddle

> If `class` was instead a kind of child, initially limited to a single instance per element, extending to multiple instances in a backward-compatible manner would not require introducing the DSL. It would be natural. Just allow many `class` children.

That's not the operative difference between children and attributes in HTML.

In HTML, if an element is unsupported, its contents are shown, while its attributes are ignored. This means, if a browser saw something like this:

    <p>
        <class>literature</class>
        <class>english</class>
        Billions of years ago, the Universe was created. This made a lot of people very angry, and has been widely considered a bad idea.
    </p>
In browsers that don't support, or even predate classes, you would want them to be ignored. This only works if they're attributes.
parent notriddle 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton