Re: [cssom] Make CSSStyleSheet constructable

On 10/19/12 4:50 PM, Dimitri Glazkov wrote:
> As Tab mentioned, I want (at least I think I do?) to have an explicit
> indication of whether the stylesheets are shared partly because it
> allows the script to know if it's a good idea to tweak this stylesheet
> (which clearly it is not).

If we really want to just have read-only stylesheets, seems like we 
could just do that, with a declarative way to say that they're 
read-only.  Again, that's if we want that.

> Another reason to think about this is a low-level hook for the
> stylesheets, declared for more than one element. In a file that
> declares multiple components, an external stylesheet is applied to all
> of the declarations:
> <link rel="stylesheet" href="x-tags/css/themes/dark-and-stormy-night.css" ...
> <element name="x-panel" ...
>      <template ...
> <element name="x-tabbox" ...
>   ...
>  From the perspective of Shadow DOM in each individual component, the
> "dark-and-stormy-night.css" is something that just magically appears
> as a member in styleSheets
> ( That
> seems sub-optimal, because it's not possible to implement without
> magic (like, for a browser that only supports Shadow DOM or some
> alternative implementation that doesn't use custom DOM elements).

I'm not sure I follow.  What sort of "magic" are we trying to avoid and 
why is adding new APIs that force script to address a common use case 
that seems like it should be addressable declaratively the way to avoid 
it?  ;)

> I am happy to hear any cool/awesome suggestions.

I'm still trying to understand the problem(s) we're trying to solve.

> I am not sure if this will happen a lot in the wild, but in the very
> first sample code I wrote for Web Components, I needed tweaking
> stylesheets to apply styles to the currently selected tab:

Er, I don't follow that at all.  Normally one would have fixed rules and 
then change a class on a node to make it match the rule you want, right? 
  Why was that not an option here?


Received on Friday, 19 October 2012 21:02:06 UTC