News for hackers. Stuff that matters.
Re:Shadow DOM enabled in Firefox nightly by tadzik_ on Monday May 28, 2018 @11:23AM (#17172900)
Any info on what this is?
Re:Shadow DOM enabled in Firefox nightly by captain_crabs on Monday May 28, 2018 @11:30AM (#17172944)
See shadow dom section in here: https://github.com/w3c/webcomponents/ which specified most of docs are maintained in here: https://dom.spec.whatwg.org/

And as for what it is, you know how a given web page has global css/query selector scope? Shadow dom is like a membrane in there, where styles and other things don't go in (unless you explicitly poke a hole). It's like a whole new document that you can nest inside an existing document. It's encapsulation inside browsers

Re:Shadow DOM enabled in Firefox nightly by Waterluvian on Monday May 28, 2018 @12:29PM (#17173277)
I wasn't aware of being able to explicitly allow in some css.

It sounds like a powerful way to make reusable components where some css can't be overridden because it would break the component (eg. Layout, shape) while allowing other parts to be overridden (colour, size, font, etc.)

Re:Shadow DOM enabled in Firefox nightly by karlshea on Monday May 28, 2018 @01:08PM (#17173495)
This is exciting, it would hugely simplify a product I work on that we have to embed with an iframe. If we could use this instead that would be a lot of scrolling and message passing and resizing code that could just go away
Re:Shadow DOM enabled in Firefox nightly by spankalee on Monday May 28, 2018 @05:39PM (#17175016)
Use it now, the polyfills are really good for older browsers.
Re:Shadow DOM enabled in Firefox nightly by bzbarsky on Monday May 28, 2018 @11:57PM (#17176372)
They are?

Polymer has a tendency to get confused by its own loading process and go into infinite loops. Are there any other shadow DOM polyfills out there?

(And last I checked, Polymer was polyfilling the old proposal, not the one that is currently being implemented in browsers.)

Re:Shadow DOM enabled in Firefox nightly by spankalee on Tuesday May 29, 2018 @03:49PM (#17182387)
I yet ever heard of infinite loops in loading. Do you have an open issue?

The webcomponentsjs package has polyfilled the v1 Web Components specs for over a year. Polymer 2.x was the version that used the new specs instead of the older v0 specs.

Re:Shadow DOM enabled in Firefox nightly by bzbarsky on Wednesday May 30, 2018 @12:15AM (#17185029)
> I yet ever heard of infinite loops in loading. Do you have an open issue?

https://bugzilla.mozilla.org/show_bug.cgi?id=1256031 has an example of a page using polymer that runs into this problem.

Re:Shadow DOM enabled in Firefox nightly by spankalee on Saturday June 02, 2018 @04:46PM (#17216286)
Did anyone file an issue on the polyfills? We're not going to be aware of issues on Firefox's bug tracker...

Also, that's an old version of the polyfills, before Polymer 2.0, it might have been fixed on our end quite a while ago.

Re:Shadow DOM enabled in Firefox nightly by karlshea on Monday May 28, 2018 @10:24PM (#17176017)
Hmm good to know I’ll definitely look into it!
Re:Shadow DOM enabled in Firefox nightly by blackbear_ on Monday May 28, 2018 @05:07PM (#17174853)
to an outsider, web development looks like hacks upon hacks upon hacks upon hacks upon ......
Re:Shadow DOM enabled in Firefox nightly by jhanschoo on Monday May 28, 2018 @08:41PM (#17175624)
Unfortunately, this is what happens when you need to ensure backward compatibility with the lowest denominator...
Re:Shadow DOM enabled in Firefox nightly by nol13 on Tuesday May 29, 2018 @07:38AM (#17178175)
this is pretty much how i feel about computing in general

if it works, it works, though.

Re:Shadow DOM enabled in Firefox nightly by porsager on Monday May 28, 2018 @11:27AM (#17172927)
It enables you to keep the markup structure, style, and behavior hidden and separate from other code on the page so that different parts do not clash.

https://developer.mozilla.org/en-US/docs/Web/Web_Components/...

Re:Shadow DOM enabled in Firefox nightly by tomkinson on Monday May 28, 2018 @11:47AM (#17173038)
Imagine you had a chat, and 30 videos in the chat.

30 play buttons 30 vulume sliders 30 pause buttons Etc

That's a lot in the DOM.

So intead you put the html5 video player components in shadowDOM and reference as needed. Only have them once then.

Re:Shadow DOM enabled in Firefox nightly by sime2009 on Monday May 28, 2018 @03:07PM (#17174161)
ShadowDOM and the other parts of the web components specs don't do any of that kind of de-duplication which you describe, sorry.
Re:Shadow DOM enabled in Firefox nightly by sametmax on Monday May 28, 2018 @12:34PM (#17173306)
But they don't have the same state. Some of them are half run. Some of them have sound off. Some are paused or playing. One is selected.

Is the state separated from structure ?

Re:Shadow DOM enabled in Firefox nightly by egeozcan on Monday May 28, 2018 @02:44PM (#17174030)
State can be orchestrated from the parent document. Custom elements can implement their own APIs.
Re:Shadow DOM enabled in Firefox nightly by sametmax on Tuesday May 29, 2018 @04:27AM (#17177336)
So what's the difference with a webcomponent ?
Re:Shadow DOM enabled in Firefox nightly by quadrature on Monday May 28, 2018 @11:26AM (#17172925)
[dead]
Re:Shadow DOM enabled in Firefox nightly by cdaringe on Monday May 28, 2018 @12:21PM (#17173230)
Browsers aren't written in JavaScript. Your tone is unwelcome.
Re:Shadow DOM enabled in Firefox nightly by voltagex_ on Monday May 28, 2018 @12:12PM (#17173166)
What would you consider a better implementation?
Re:Shadow DOM enabled in Firefox nightly by kuschku on Monday May 28, 2018 @12:40PM (#17173342)
Androids Toolkit is much more powerful because it allows custom layouting engines.

If web components was just a port of the Android toolkit we'd have canvas with accessibility, CSS grid as library not in the browser, and usable recycler views.

Re:Shadow DOM enabled in Firefox nightly by spankalee on Monday May 28, 2018 @05:42PM (#17175027)
Custom layout is a complete separate spec, and being intended in Chrome right now.

Web Components don't have to solve every known problem, some things are also solvable on their own.

Re:Shadow DOM enabled in Firefox nightly by kuschku on Tuesday May 29, 2018 @07:04AM (#17178010)
The whole point is that you get many more features.

On Android, every element just knows its children, attributes, can process events, and can draw itself to a canvas or describe itself to a screenreader.

This means designing a new layout is just another element that then knows how to position its children.

An element that can change opacity slowly of its elements, or filter the text, is also just another element.

You can do everything with it and still be accessible.

And I'm not sure if you've ever tried implementing a RecyclerView on the web? It's absolute horror. Either you have to entirely hijack scrolling and thereby kill flinging and smooth scroll of the browser, or you have to use a lot of JS to at least make it seem real.