Re: [cssom] Make CSSStyleSheet constructable

On Sat, Oct 20, 2012 at 1:27 AM, François REMY
<fremycompany_pub@yahoo.fr> wrote:
> |  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?

Yes! This is bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=15954
and Tab had sketched out a solution there that is similar to yours.
Please feel encouraged to respond/improve! :)

:DG<

Received on Saturday, 20 October 2012 15:26:57 UTC