Re: [shadow-styling] Scoping at-rules like @font-face in scoped styled and shadow trees?

On Tue, Feb 25, 2014 at 9:19 PM, Cameron McCormack <> wrote:
> Tab Atkins Jr. wrote:
>> Nobody else has any opinions?  If not, we should go with #1 and settle
>> it in a spec.
> I don't like #1 at all.  I think the risk of name collision is too great.
> Off the top of my head solution to satisfy #2:
> * Every style sheet is assigned a unique identifier of some sort
> automatically.
> * The name that a given at-rule defines (like the font-family in an
> @font-face, the identifier right after the @keyframes) is implicitly
> prefixed with this unique identifier.
> * To reference a name that has been declared in a scoped style sheet you use
> say scoped(name).  This is expanded out to <unique_identifier> + name at
> specified value time.

This is pretty interesting!  It sounds good to me, and I discussed
this with Dimitri and he liked it too.

Some implementation feedback: it's easy for us to implement scoping of
global names per "scoping root" - documents and shadow roots, the
kinds of things that provide a unique scope for element IDs.  It's
hard to us to implement scoping for arbitrary elements.

So we'd be supportive of exactly that - specify that at-rules which
define global names automatically associate them with the nearest
scoping root, and you have to use "scoped()" to get at the names
attached to the current scoping root.  Using the name itself always
looks at the global set.  (Well, the names attached to the document

This would mean that scoped stylesheets by themselves aren't affected,
since their nearest scoping root (using the above definition) isn't
their scoping element, but rather the document or their shadow root.
I suggest letting them work and define global names normally.  In
other words, what I'm describing here has nothing do with scoped
stylesheets at all (so we do option #1); it instead cares about the
vaguely-similar concepts of ID-scoping roots.


Received on Wednesday, 26 February 2014 22:51:36 UTC