- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 19 Oct 2012 17:01:36 -0400
- To: Dimitri Glazkov <dglazkov@google.com>
- CC: "Tab Atkins Jr." <jackalmage@gmail.com>, "www-style@w3.org" <www-style@w3.org>
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 > (http://www.w3.org/TR/shadow-dom/#api-shadow-root-style-sheets). 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: > > https://github.com/dglazkov/Web-Components-Polyfill/blob/master/samples/tabs/tabs-component.html#L221 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? -Boris
Received on Friday, 19 October 2012 21:02:06 UTC