from Hacker News

Decorative Text Within HTML

by tobr on 6/2/25, 5:26 PM with 5 comments

  • by _benton on 6/2/25, 8:44 PM

    My favourite is using emojis for classes. It's pointless but I think it's funny and that's gotta count for something right?
  • by spankalee on 6/2/25, 10:11 PM

    I would double check that this doesn't have performance implications before going wild. Those are extra tokens that need to be parsed, and browsers do a lot of work to speed up selector matching, including building caches of class names to nodes.

    It could be that browsers populate these caches even for unused class names because it's difficult to know at that point in time whether a class name is used or will be used in the future. A ton of unused class names could explode the cache, evict important classes... who knows?

    It could also be that the cache is built on demand as selectors are matched and having a ton of unused classes doesn't matter at all.

    The point is that it's quite implementation dependent and requires some testing to know. To be safe, I'd just stick to comments because they are very, very cheap, in all browsers and parsers.

  • by someothherguyy on 6/3/25, 1:00 AM

    > Yes. That is perfectly valid HTML.

    not a wild revelation, https://html.spec.whatwg.org/multipage/dom.html#global-attri...