You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,10 @@ The resulting data structure consists mainly of five basic types: `CSSList`, `Ru
63
63
*`Document` – representing the root of a CSS file.
64
64
*`MediaQuery` – represents a subsection of a CSSList that only applies to a output device matching the contained media query.
65
65
66
+
To access the items stored in a `CSSList` – like the document you got back when calling `$oCssParser->parse()` –, use `getContents()`, then iterate over that collection and use instanceof to check whether you’re dealing with another `CSSList`, a `RuleSet`, a `Import` or a `Charset`.
67
+
68
+
To append a new item (selector, media query, etc.) to an existing `CSSList`, construct it using the constructor for this class and use the `append($oItem)` method.
69
+
66
70
#### RuleSet
67
71
68
72
`RuleSet` is a container for individual rules. The most common form of a rule set is one constrained by a selector. The following concrete subtypes exist:
@@ -72,6 +76,8 @@ The resulting data structure consists mainly of five basic types: `CSSList`, `Ru
72
76
73
77
Note: A `CSSList` can contain other `CSSList`s (and `Import`s as well as a `Charset`) while a `RuleSet` can only contain `Rule`s.
74
78
79
+
If you want to manipulate a `RuleSet`, use the methods `addRule(Rule $oRule)`, `getRules()` and `removeRule($mRule)` (which accepts either a Rule instance or a rule name; optionally suffixed by a dash to remove all related rules).
80
+
75
81
#### Rule
76
82
77
83
`Rule`s just have a key (the rule) and a value. These values are all instances of a `Value`.
@@ -90,12 +96,6 @@ There is another abstract subclass of `Value`, `ValueList`. A `ValueList` repres
90
96
*`RuleValueList` – The default type, used to represent all multi-valued rules like `font: bold 12px/3 Helvetica, Verdana, sans-serif;` (where the value would be a whitespace-separated list of the primitive value `bold`, a slash-separated list and a comma-separated list).
91
97
*`CSSFunction` – A special kind of value that also contains a function name and where the values are the function’s arguments. Also handles equals-sign-separated argument lists like `filter: alpha(opacity=90);`.
92
98
93
-
To access the items stored in a `CSSList` – like the document you got back when calling `$oCssParser->parse()` –, use `getContents()`, then iterate over that collection and use instanceof to check whether you’re dealing with another `CSSList`, a `RuleSet`, a `Import` or a `Charset`.
94
-
95
-
To append a new item (selector, media query, etc.) to an existing `CSSList`, construct it using the constructor for this class and use the `append($oItem)` method.
96
-
97
-
If you want to manipulate a `RuleSet`, use the methods `addRule(Rule $oRule)`, `getRules()` and `removeRule($mRule)` (which accepts either a Rule instance or a rule name; optionally suffixed by a dash to remove all related rules).
98
-
99
99
#### Convenience methods
100
100
101
101
There are a few convenience methods on Document to ease finding, manipulating and deleting rules:
0 commit comments