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 10:27:56 +0200
Message-ID: <7ECB8D8C436C41D4B08A35B21B7DBB44@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. An idea:

    @virtual-namespace tab-data "http://jquery.com/namespaces/tab-data";
    h2[tab-data|selected] {
        ...
    }

    var tabData = getVirtualNamespace("tab-data");

    // add the virtual attribute to the element
    tabData.set(element, "selected", "true");

    // remove the virtual attribute
    tabData.set(element, "selected", null);

Virtual namespaces would be recognized by URL and would be shared accross 
css documents using the same "virtual-namespace" declaration. However, each 
document need to have an @virtual-namespace declaration to map a CSS name to 
a virtual namespace.

To the contrary of real namespaces, virtual namespaces would not rely on 
attributes but on weakmaps (at least, this is what the API would induce, the 
internal implementation could be different).

Doesn't that solve your initial problem more elegantly than just rewriting a 
stylesheet evertime you need to change something on an element outside the 
template you don't want to touch? 
Received on Saturday, 20 October 2012 08:28:09 GMT

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