W3C home > Mailing lists > Public > www-style@w3.org > October 2012

Re: [cssom] Make CSSStyleSheet constructable

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Sat, 20 Oct 2012 12:55:08 +0200
Message-ID: <EC8D5DB4B28A49A987CB0C59B1C897A3@FREMYD2>
To: "Dimitri Glazkov" <dglazkov@google.com>
Cc: "Boris Zbarsky" <bzbarsky@mit.edu>, "Tab Atkins Jr." <jackalmage@gmail.com>, <www-style@w3.org>, "Tony Ross" <tross@microsoft.com>
|  |  I don't see how? The tabs are not in the template.
|
|  Then you need a way add "invisible" classes from the component.

Now that I think about it, you could even use a normal namespace for the use 
case. I do believe that the external document using the tab component may 
also want to apply some custom style to the selected tab or tab-strip. I'm 
not sure at all it makes sense to hide this information to him since he can 
retreive it back from other (complicated) ways anyway.



For example, you may have two kinds of tab-stips (the ones that become blue 
when selected and the ones that become red). If you have a "@namespace 
tab-data" to get the selection properties, you can simply have the following 
declaration in your document's stylesheet:

    h2.red[tab-data|selected] { color: red !important; }
    h2.blue[tab-data|selected] { color: blue !important; }

that would override the default style defined in your template's stylesheet:

    h2[tab-data|selected] { color: black; }

If your component doens't leak the selection status, you can't apply those 
'overidden' styles easily.



By the way, your current solution (relying on nth-of-type to show the right 
tab) fails to handle correctly the insertion of new tabs at runtime. If you 
insert a new tab before the currently selected tab, the focus will move to 
the previous tab without any user interaction. If you're using an attribute, 
you don't have the same issue. 
Received on Saturday, 20 October 2012 10:55:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:01 GMT