Re: [cssom] Author-defined at-rules

Le 01/07/2013 18:10, Tab Atkins Jr. a écrit :
> partial interface CSS {
>    readonly attribute CSSCustomRuleMap customRules;
> }
>
> [MapClass(DOMString, sequence<CSSCustomRule>)]
> interface CSSCustomRuleMap {
> }
> (The map entries for CSSCustomRuleMap are all the custom at-rules in
> all stylesheets in the document, with the custom rule's name (the
> at-keyword, minus the leading @) as the key and the rule itself as the
> value.)
>
> interface CSSCustomRule {
>    attribute DOMString name;
>    attribute DOMString prelude; /* strip whitespace tokens from the
> start/end of the prelude */
>    attribute DOMString? value; /* null if the rule is ended with a
> semicolon rather than a block */
>    readonly attribute Element? scopingElement; /* scoped style rule */
>    readonly attribute boolean active; /* either top-level, or in an
> active conditional rule */
>    EventTarget onactive; /* I can't remember the exact WebIDL for this,
> and don't want to look it up right now. */
>    EventTarget oninactive;
> }

I’m still not super-convinced, but if we go with this:

* The sequences of rules (values of the map) should be in cascading order

* The name could have the "var-" (or whatever) prefix removed, like 
Variables

* Like Variables, the prelude and block are re-serialization of 
tokens/component values, and may not be exactly as in the source. (In 
particular regarding whitespace and CSS comments.)

-- 
Simon Sapin

Received on Monday, 1 July 2013 17:24:50 UTC