News for hackers. Stuff that matters.
Re:Declarative Shadow DOM by rado on Friday October 02, 2020 @01:56AM (#24659365)
After some articles stated Web Components are dead, this is welcome development. The current JS requirement is a drag.
Re:Declarative Shadow DOM by DaiPlusPlus on Friday October 02, 2020 @03:37AM (#24660057)
> The current JS requirement is a drag

HTML could be so much more useful and time-saving if more functionality could be built without JavaScript.

Thanks to CSS tricks, such as using the `:checked` pseudo-class in invisible form elements (toggled with a visible `<label for="">` I can implement neat show/hide effects in websites without any script - my current server-side-rendered project has a reusable "tab control" that doesn't use any client-script at all. It's great because it will always just-work, even if the user has weird privacy/script settings.

I can distill what I want down to two simple things: I want more CSS pseudo-classes based on the live DOM state (and the ability to add arbitrary wrapper boxes around or inside any element) and more native HTML elements that can mutate the DOM without requiring any scripts.

Re:Declarative Shadow DOM by ksec on Friday October 02, 2020 @11:35AM (#24663693)
>HTML could be so much more useful and time-saving if more functionality could be built without JavaScript.

I wish there is a movement for this. But unfortunately the Web Standard today is pretty much dedicated by Google. ( Although Apple and Mozilla still has some leverage )

Re:Declarative Shadow DOM by ZephyrBlu on Friday October 02, 2020 @04:41AM (#24660466)
It works, but that feels like you're hijacking HTML/CSS for an unintended use case.
Re:Declarative Shadow DOM by DaiPlusPlus on Friday October 02, 2020 @05:43AM (#24660783)
The web today: as a platform for user interfaces and general-purpose content display, is far, far removed from HTML's "intended use case" as a means of sharing simple documents.

Like it or not, but HTML+CSS is being used for all kinds of UI - and right now you absolutely need JS to support state-transitions in HTML, even if those states arguably shouldn't need any script because the same logic can be expressed without using a Turing-complete programming language.

Re:Declarative Shadow DOM by tehbeard on Friday October 02, 2020 @02:12AM (#24659471)
So it provides a way to reuse CSS scoped for web components without needing JS?

Neat, I guess, but that's only really useful for basic layout components? Anything more complicated needs JS for behaviour/interactive functionality?

I guess it speeds up first paint, but again it feels like you'd send up with components on the page that look functional, but aren't wired up to do what they are supposed to until the JS comes down and adds event listeners etc.

Re:Declarative Shadow DOM by rado on Friday October 02, 2020 @02:53AM (#24659727)
Yes. Many components don't need JS at all, or use it as enhancement only.
Re:Declarative Shadow DOM by zubairq on Friday October 02, 2020 @04:19AM (#24660328)
Could you post some links? I didn't know that web components were dying out. Thanks
Re:Declarative Shadow DOM by rado on Monday October 05, 2020 @11:06AM (#24688395)
Re:Declarative Shadow DOM by rado on Monday October 05, 2020 @11:06AM (#24688402)
Some features were scrapped, hence the notion of dying out.
Re:Declarative Shadow DOM by throw_m239339 on Friday October 02, 2020 @04:37AM (#24660444)
> After some articles stated Web Components are dead, this is welcome development. The current JS requirement is a drag.

It doesn't solve a much things. The Web Components spec is IMHO too complicated and doesn't really yield direct results for front end developers.