W3C home > Mailing lists > Public > www-style@w3.org > November 2015

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

From: Ryosuke Niwa <rniwa@apple.com>
Date: Wed, 11 Nov 2015 14:32:14 -0800
Cc: Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
Message-id: <428BEF77-9E1B-4997-8DA8-4F25D7212FBE@apple.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

> On Nov 11, 2015, at 1:51 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> 
> This doesn't address the other issue that I haven't been able to solve
> yet, which is font names inheriting down into a shadow where the font
> name is defined to be something else entirely.  That is:
> 
> <style>
> @font-face { font-family: foo; src: local("helvetica"); }
> body { font-family: foo; }
> </style>
> <custom-el>
>  <::shadow>
>    <style>
>    @font-face { font-family: foo; src: local("comic sans"); }
>    h1 { font-family: foo; }
>    </style>
>    <h1>Comic sans heading, yay!</h1>
>    <p>Whoops, Comic Sans body text.</p>
>  </::shadow>
> </custom-el>
> 
> There's no way in the current system to make sure that the *inherited*
> foo font refers to the outer face, but the specified one on the
> heading refers to the inner face.

Do you have any evidence indicating that this is a common scenario?

If this was an issue, then passing a CSS variable through a shadow boundary is similarly problematic. Consider:

<style>
body { --foo: blue; color: var(--foo); }
</style>
<custom-el>
 <::shadow>
   <style>
   div { --foo: red; }
   h1 { color: var(--foo); }
   </style>
   <div>
     <h1>Comic sans heading, yay!</h1>
     <p>Whoops, Comic Sans body text.</p>
   </div>
 </::shadow>
</custom-el>

- R. Niwa
Received on Wednesday, 11 November 2015 22:32:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:58 UTC