Live data from Hacker News

You can make up HTML tags

maurycyz.com

101–110 of 202 posts

Re: You can make up HTML tags

#101

I used this to implement , the opposite of , to be able to designate sections of a page to be hidden if JS was disabled. You can of course do the same thing with classes, but custom tags are fun. https://github.com/aaviator42/yes-script

By the way, you can also do this pure CSS using the scripting media feature: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/A...

Re: You can make up HTML tags

#102
post #24

... a bunch more HTML ... Just one quibble over this specific example (not the broader concept, which is sound): it probably didn’t have to be div soup to begin with. Something like this may have been more reasonable: ... a bunch more HTML ...

This example also shows a weakness of custom tags compared with using the class attribute. An element can have only single name but may have several classes. And as classes are unordered set, one cannot in general emulate that with several elements as the nesting introduces an order absent in the class list.

[deleted]

Re: You can make up HTML tags

#103

> If you include hyphens in the name, you can guarantee that your tag won’t appear in any future versions of HTML. Which future version? Is there something I'm missing? I'd like to have html6 that has feature parity with native, but I'm afraid we got html5 and just stopped there. And if there will be an html6 why can't we just state "use version 5 in this document" so there won't be any name clashing between supporte…

> but I'm afraid we got html5 and just stopped there.

They dropped numbered versions. Now it is just HTML which is continuously evolved in a backwards-compatible manner.

> And if there will be an html6 why can't we just state "use version 5 in this document"

Because browser vendors are opposed to explicit versioning, since it introduces multiple rendering modes.

Re: You can make up HTML tags

#104
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 and , or 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."

Re: You can make up HTML tags

#105
Custom elements have their purpose, but in most cases you don't need them and existing elements suffice.

With how this article was written (the use of "then" when they meant "than", mentioning "article-heading" when that is not in their previous example, but rather "article-header") makes me believe this didn't get much thought on the topic they wrote about, but rather wrote up a quick post.

Additionally, the problems that they bring up can be mitigated with the use of BEM structure for their class names.

Re: You can make up HTML tags

#106
post #29

Earlier quoted context omitted.

I used custom elements extensively in 2014 when support was not as widespread. I think it's a beautiful, elegant solution and I'm still a little bit bitter that React became as big as it was. Now everything "has" to be a SPA because developers want to use React, whereas most users would actually be better served with good 'ol HTML with some custom elements where needed.

I’ve been getting into SSR with JSX as a template engine using kita. You still get full typescript analysis and composability. It beats any other SSR web templating system I’ve used. I agree the need for everything to be a react app by default has gotten out of control. But I think if you’re a startup with unknown future needs it’s hard to ignore the flexibility and power of something like react. If you know you’re j…

You do the crud app and then they want: just make this to edit inline. You do some Ajax api Call with a tiny js. Then you need more and more. Then you have a mess and you’d be better with react. I still can’t find a project id be better of without react. When I tried without it bite me very quickly.

Re: You can make up HTML tags

#107
Can check out the DOM of https://radio4000.com to see how custom-elements and web-components can be used to describe the entire app (and allow custom themes, and more) (source: https://github.com/radio4000/components) — no css class, full description of the app's state via html attributes (reflected in styles)

Re: You can make up HTML tags

#108
Exactly why I banned React from my pipelines years ago, native Web Components + dispatchEvent gives you the modern web without bloat and churn, and Vite for a lightweight HMR thanks to native ES Modules.

Server-side you can use jsdom to polyfill document, it supports Web Components too.

Re: You can make up HTML tags

#109

Exactly why I banned React from my pipelines years ago, native Web Components + dispatchEvent gives you the modern web without bloat and churn, and Vite for a lightweight HMR thanks to native ES Modules. Server-side you can use jsdom to polyfill document, it supports Web Components too.

web components are terrible and should not be used for modern development with the exception of very nieche use cases that require sandboxing

Re: You can make up HTML tags

#110
post #30

Many years ago, I decided to reinvent the `blink` tag, because the monsters who make browsers removed support for it. I didn't know you could just make up tags, but I figured I'd give it a shot, and with a bit of jquery glue and playing with visibility settings, I was able to fix browsers and bring back the glorious blinking. I was surprised you could just do that; I would have assumed that the types of tags are fina…

> because the monsters who make browsers removed support for it Most browsers never implemented it in the first place. Safari, Chrome, IE and Edge never had it. In terms of current browser names, it was only Firefox and Opera that ever had it, until 2013.

IE was holding back the progress even before Chrome and Safari were a thing.
Post reply on HN