This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spec:at-rules-patterns [2011/12/06 23:37] – [Spec Text] dbaron | spec:at-rules-patterns [2014/12/09 15:48] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
At-rules can generally be grouped into four categories: | At-rules can generally be grouped into four categories: | ||
- | | + | - processing instructions (like @import or @charset) |
- | 2. 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) | + | |
- | 4. 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: | + | When creating a new at-rule, you need to add some CSSOM stuff as well: |
- | For category 1 rules, the interface | + | **A new constant** (coordinated at the [[CSSOM Constants]] page), added to the CSSRule |
- | For category 2 rules, the interface | + | partial |
+ | const unsigned short FOO_RULE = [number]; | ||
+ | }; | ||
- | For category 3 and 4 rules, the interface | + | **A new interface:** |
- | There is no need to define | + | For category 1 rules, |
- | 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, | ||
+ | |||
+ | interface CSSMediaRule : CSSConditionRule { | ||
+ | readonly attribute MediaList media; | ||
+ | } | ||
+ | |||
+ | (CSSConditionRule inherits from CSSGroupingRule, | ||
+ | |||
+ | For category 3 and 4 rules, the interface should expose attributes for all the descriptors, | ||
+ | |||
+ | 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 |