| Class | CssParser::RuleSet |
| In: |
lib/css_parser/rule_set.rb
|
| Parent: | Object |
| RE_ELEMENTS_AND_PSEUDO_ELEMENTS | = | /((^|[\s\+\>]+)[\w]+|\:(first\-line|first\-letter|before|after))/i | Patterns for specificity calculations | |
| RE_NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES | = | /(\.[\w]+)|(\[[\w]+)|(\:(link|first\-child|lang))/i | ||
| BACKGROUND_PROPERTIES | = | ['background-color', 'background-image', 'background-repeat', 'background-position', 'background-size', 'background-attachment'] | ||
| LIST_STYLE_PROPERTIES | = | ['list-style-type', 'list-style-position', 'list-style-image'] | ||
| FONT_STYLE_PROPERTIES | = | ['font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', 'font-family'] | ||
| BORDER_STYLE_PROPERTIES | = | ['border-width', 'border-style', 'border-color'] | ||
| BORDER_PROPERTIES | = | ['border', 'border-left', 'border-right', 'border-top', 'border-bottom'] | ||
| NUMBER_OF_DIMENSIONS | = | 4 | ||
| DIMENSIONS | = | [ ['margin', %w(margin-top margin-right margin-bottom margin-left)], ['padding', %w(padding-top padding-right padding-bottom padding-left)], ['border-color', %w(border-top-color border-right-color border-bottom-color border-left-color)], ['border-style', %w(border-top-style border-right-style border-bottom-style border-left-style)], ['border-width', %w(border-top-width border-right-width border-bottom-width border-left-width)], ] |
| selectors | [R] | Array of selector strings. |
| specificity | [RW] | Integer with the specificity to use for this RuleSet. |
Add a CSS declaration to the current RuleSet.
rule_set.add_declaration!('color', 'blue')
puts rule_set['color']
=> 'blue;'
rule_set.add_declaration!('margin', '0px auto !important')
puts rule_set['margin']
=> '0px auto !important;'
If the property already exists its value will be over-written.
Iterate through selectors.
Options
ruleset.each_selector do |sel, dec, spec|
...
end
Remove CSS declaration from the current RuleSet.
rule_set.remove_declaration!('color')