Skip to content

Commit 7c30973

Browse files
committed
Update README.md
Move stuff around
1 parent 2cc55a2 commit 7c30973

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ The resulting data structure consists mainly of five basic types: `CSSList`, `Ru
6363
* `Document` – representing the root of a CSS file.
6464
* `MediaQuery` – represents a subsection of a CSSList that only applies to a output device matching the contained media query.
6565

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+
6670
#### RuleSet
6771

6872
`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
7276

7377
Note: A `CSSList` can contain other `CSSList`s (and `Import`s as well as a `Charset`) while a `RuleSet` can only contain `Rule`s.
7478

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+
7581
#### Rule
7682

7783
`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
9096
* `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).
9197
* `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);`.
9298

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-
9999
#### Convenience methods
100100

101101
There are a few convenience methods on Document to ease finding, manipulating and deleting rules:

0 commit comments

Comments
 (0)