Live data from Hacker News

You can make up HTML tags

maurycyz.com

91–100 of 202 posts

Re: You can make up HTML tags

#91
are NOT unrecognized tags!

I blogged about this: https://dashed-html.github.io

◄ = always an HTMLUnknownElement until the WHATWG adds it as new Element.

◄ = (No JS!) UNDEFINED Custom Element, valid HTMLElement, great for layout and styling

◄ Upgraded with the JavaScript Custom Elements API it becomes a DEFINED Custom Element

---

► This is standard behaviour in all browsers. Chrome (2016) Safari (2017) FireFox (2018) Edge (2020)

► The W3C HTML Validator accepts all Custom Elements with a dash as HTMLElement. It does not accept (no dash), those are HTMLUnknownElement

► The UA - UserAgent StyleSheet (Browsers default stylesheet) defines CSS [hidden] { display:none }. But Custom Elements do not inherit the default stylesheet; so you have to add that behaviour yourself in your stylesheet.

► is display:block only in the UA StyleSheet You have to set the display property on these Custom Elements yourself (You will forget this 20 times, then you never make the mistake again)

► The CSS :defined pseudo selector targets standard HTML tags and JavaScript defined Custom Elements

► Thus the CSS :not(:defined) pseudo selector targets the UNDEFINED Custom Elements; they are still valid HTMLElement, CSS applies like any element

► DSD - Declarative ShadowDOM: creates the same undefined Custom Elements with a shadowDOM

Re: You can make up HTML tags

#92
post #29
post #4

By default, they will behave like spans. You can customize it using the Custom Element API: https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...

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.

> Now everything "has" to be a SPA because developers want to use React

Have you followed anything in the last 5 years? Outside of bootcamp students, this has been on the decline for a while… in some cases overcorrecting for where a SPA might make more sense.

Re: You can make up HTML tags

#94
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.

Re: You can make up HTML tags

#95
post #42

Earlier quoted context omitted.

I for one am glad that blink is no longer a thing, it's certainly behavior that should require more thought than a simple html element can provide.

I just kind of feel like removing it makes the internet less fun. 90's internet was basically a playground for geeky people to make things purely for fun, with basically no ambitions of making any money; people would host their own terrible web pages. My first real introduction to "programming" (other than making a turtle walk around) was when I was nine years old and bought "Make Your Own Web Page : A Guide for Kids…

You have me in tears...

Re: You can make up HTML tags

#96
post #91

are NOT unrecognized tags! I blogged about this: https://dashed-html.github.io ◄ = always an HTMLUnknownElement until the WHATWG adds it as new Element. ◄ = (No JS!) UNDEFINED Custom Element , valid HTMLElement, great for layout and styling ◄ Upgraded with the JavaScript Custom Elements API it becomes a DEFINED Custom Element --- ► This is standard behaviour in all browsers. Chrome (2016) Safari (2017) FireFox (2018)…

> The UA - UserAgent StyleSheet (Browsers default stylesheet) defines CSS [hidden] { display:none }

I can only speak for Chromium, but this isn't about the UA stylesheet; everything in the UA stylesheet applies to custom elements just the same as the more standard HTML elements (e.g. the rule for [popover] will apply just fine to custom elements AFAIK), and there is no [hidden] rule in the UA stylesheet. You're probably mixing it up with the fact that hidden is a HTML presentation attribute, similar to how you can write and it will become its own little property value set that gets applied to the element. That is indeed only the case for HTMLElements. (The difference matters for priority in the cascade; in particular, presentation attribute style has zero specificity.)

Re: You can make up HTML tags

#97

Isn't this the basis for every web framework? E.g., Vue Templates?

Frameworks generally change those to standart tags at build time. Vue can be used without a build step so it indeed uses custom tags for components in that scenario but it is not very common to use Vue without a build step.

Re: You can make up HTML tags

#98
post #53

Earlier quoted context omitted.

Huh, I would have sworn that Internet Explorer had the blink tag at one point, but I think my parents had Netscape and then Mozilla pretty early so maybe that's what I'm confusing it with. Regardless, I stand by my comment. Monsters! I want my browser to be obnoxious.

Never mind, Microsoft got you with . In theory, in 1996 Netscape and Microsoft agreed to kill and https://www.w3.org/People/Raggett/book4/ch02.html >, but although they were kept out of the spec , neither removed its implementation, and then IE dominated the browser market, and became popular enough that the remaining parties were bullied into shipping it (Netscape in 2002, Presto in 2003, no idea about the KHTML/Web…

KHTML added support in October 2003 (commit 7bcdd98aa in the Chromium repository).

Re: You can make up HTML tags

#99
You can, but maybe you shouldn't.

If, for some reason the CSS doesn't load, your site may break completely instead of degrading gracefully. Maybe it will mess with people who have an unusual browser configuration too. It may look nice on your side, but on the user side, I only see disadvantages. It may look like it saves a few bytes, but with compression, it may not.

Re: You can make up HTML tags

#100
post #98

Earlier quoted context omitted.

Never mind, Microsoft got you with . In theory, in 1996 Netscape and Microsoft agreed to kill and https://www.w3.org/People/Raggett/book4/ch02.html >, but although they were kept out of the spec , neither removed its implementation, and then IE dominated the browser market, and became popular enough that the remaining parties were bullied into shipping it (Netscape in 2002, Presto in 2003, no idea about the KHTML/Web…

KHTML added support in October 2003 (commit 7bcdd98aa in the Chromium repository).

I have to say, that is some excellent sleuthing.
Post reply on HN