Re: Insulating part of a HTML document from global CSS

On Sun, Nov 17, 2013 at 8:42 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/17/13 11:23 AM, Tab Atkins Jr. wrote:
>> Putting together a simple web component that just pulls its light-DOM
>> contents into its own shadow is pretty simple and easy, and does
>> everything you need - the email will be protected from outside styles,
>> and it's styles won't be able to leak out, either.
>
> Speaking of, by the way, what is the interaction of components with
> document.styleSheets?

Stylesheets show up in the .stylesheets property of the shadow root
their <style> or <link> is in (or the document, if they're in the
topmost light dom).

> And how exactly do scoped stylesheets interact with
> web components?  Does the scoping happen on the DOM or the flattened tree?

The DOM, though I don't think this is well-specified at the moment.
(All the styling stuff in the Shadow DOM spec is out of date right
now.)

~TJ

Received on Sunday, 17 November 2013 17:26:33 UTC