Re: [cssom] Make CSSStyleSheet constructable

|  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 UTC