Re: [WICG/webcomponents] Custom 'void' or self-closing elements (HTML parser changes) (#624)

> I don't understand why xml can self-closing tags freely and html cannot? What's the problem?

 xml is invalid html, it goes through extra processing to be interpreted. HTML can't do that because it isn't an abstraction on top of itself, that's also what makes it different from TypeScript. Typescript isn't valid JavaScript and requires an additional build/transpilation step to be made into valid JavaScript. If you want self closing tags for web components in HTML, you'd have to change HTML and the sentiment seems to be that they aren't willing to make that kind of change to HTML (the backbone of the web). Frontend frameworks like React and Svelte can do it but that's because of JSX and again, an additional build step.

With that being said all browsers seem to support using <custom-element />, it's just converted to a properly closing tag ( <custom-element></ custom-element> ) when the browser loads the content so I'm a bit confused as to what the discussion is about. It may not be a best practice but it works. Use wisely. If I'm wrong about this and my eyes are deceiving me please let me know but it appears this has been possible since HTML5 came out.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/624#issuecomment-2347015828
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/624/2347015828@github.com>

Received on Thursday, 12 September 2024 18:53:49 UTC