Hacker News new | ask | show | jobs
by captain_crabs 2949 days ago
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

3 comments

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.)

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
Use it now, the polyfills are really good for older browsers.
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.)

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.

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

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.

Hmm good to know I’ll definitely look into it!
to an outsider, web development looks like hacks upon hacks upon hacks upon hacks upon ......
Unfortunately, this is what happens when you need to ensure backward compatibility with the lowest denominator...
this is pretty much how i feel about computing in general

if it works, it works, though.