Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
spec:at-rules-patterns [2011/12/06 23:37] – [Spec Text] dbaronspec:at-rules-patterns [2012/09/13 13:44] – [CSSOM] Rewrite with examples, fix an error. tabatkins
Line 5: Line 5:
 At-rules can generally be grouped into four categories:  At-rules can generally be grouped into four categories: 
  
- 1. processing instructions (like @import or @charset) +  - processing instructions (like @import or @charset) 
- 2. rules that change the context of rules inside them (like @media or @region) +  rules that change the context of rules inside them (like @media or @region) 
- 3. rules that apply properties to things in the document other than elements (like @page or @viewport) +  rules that apply properties to things in the document other than elements (like @page or @viewport) 
- 4. rules that define values which are too complex to define inline (like @font-face or @keyframes)+  rules that define values which are too complex to define inline (like @font-face or @keyframes)
  
 ===== Spec Text ===== ===== Spec Text =====
Line 33: Line 33:
 ===== CSSOM ===== ===== CSSOM =====
  
-All new at-rules need to add a few things to the CSSOM: a new constant (coordinated at the [[CSSOM Constants]] page) and a new interface that inherits from CSSRule.+When creating a new at-rule, you need to add some CSSOM stuff as well:
  
-For category 1 rules, the interface should have attributes exposing all of the information they contain, like [[http://dev.w3.org/csswg/cssom/#css-import-rule|the @import rule]].+**A new constant** (coordinated at the [[CSSOM Constants]] page)added to the CSSRule interface like:
  
-For category 2 rules, the interface should expose a ''cssRules'' or ''childRules'' (which?) attribute containing the child rules, and attributes for any other information they contain, like the selector in an @region.  +    partial interface CSSRule { 
 +        const unsigned short FOO_RULE = [number]; 
 +    };
  
-For category 3 and 4 rules, the interface should expose a ''style'' attribute containing all the descriptors, and attributes for any other information they contain, like the name of a @counter-style.+**A new interface:**
  
-There is no need to define the ''cssText''''parentRule''or ''parentStylesheet'' for your interface; these are defined by CSSRule.+For category 1 rules, the interface should inherit from CSSRuleand have attributes exposing all the information they contain.  For examplehere's the @import rule:
  
-If you don't understand how to write WebIDL for the interfaces, just ask.+    interface CSSImportRule : CSSRule { 
 +        readonly attribute DOMString href; 
 +        readonly attribute MediaList media; 
 +        readonly attribute CSSStyleSheet styleSheet; 
 +    };
  
 +For category 2 rules, the interface should inherit from CSSGroupingRule, and have attributes for any other information they contain.  For example, here's the @media rule:
 +
 +    interface CSSMediaRule : CSSConditionRule {
 +        readonly attribute MediaList media;
 +    }
 +
 +(CSSConditionRule inherits from CSSGroupingRule, so it still satisfies the above criteria.)
 +
 +For category 3 and 4 rules, the interface should expose attributes for all the descriptors, and attributes for any other information they contain, like the name of a @counter-style.  For example, here's the @counter-style rule.
 +
 +    interface CSSCounterStyleRule : CSSRule {
 +        readonly attribute DOMString name;
 +        readonly attribute DOMString type;
 +        readonly attribute DOMString symbols;
 +        readonly attribute DOMString additiveSymbols;
 +        readonly attribute DOMString negative;
 +        readonly attribute DOMString prefix;
 +        readonly attribute DOMString suffix;
 +        readonly attribute DOMString range;
 +        readonly attribute DOMString fallback;
 +    }
 +
 +If you don't understand how to write WebIDL for the interfaces, just ask.
 ===== Grammar ===== ===== Grammar =====
  
 TODO TODO
 
spec/at-rules-patterns.txt · Last modified: 2014/12/09 15:48 by 127.0.0.1
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki