Re: [css-scoping] Scoping @font-face defined in shadow DOM

> On Nov 10, 2015, at 6:28 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> 
> On 11/10/15 9:22 PM, Ryosuke Niwa wrote:
>> What I mean is that @font-face rules inside a shadow DOM should not affect what fonts are used inside another shadow DOM.
> 
> So just to make sure I understand, if I have this light DOM:
> 
>  <body>
>    <x-foo>Some text</x-foo>
>  </body>
> 
> and x-foo has a shadow DOM attached that makes the flattened tree look kinda like this:
> 
>  <body>
>    <x-foo>
>      <some-stuff>
>        Some text
>      </some-stuff>
>    </x-foo>
>  </body>
> 
> then should @font-face rules from inside that shadow DOM affect "Some text"?

It does if "some-stuff" element is in the shadow DOM.

> What if "Some text" were inside a <span> inside the <x-foo>?

By inside <x-foo>, do you mean inside the shadow DOM of the x-foo? (1)
Or outside the shadow DOM but as an immediate child of the x-foo element? (2)

For (1), yes (@font-face rules inside shadow DOM would affect) since its parent element is in the shadow DOM.
For (2), no since its parent element is not in the shadow DOM.

I understand this is confusing for authors but no more so than inherited vs. non-inherited properties.
If the author specified "color" and "background-color" inside a shadow DOM,
only "color" will be inherited to a slotted element by default.

- R. Niwa

Received on Wednesday, 11 November 2015 02:44:49 UTC