Document
extends CSSBlockList
in package
The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks, but also any @-rules encountered.
Table of Contents
- $aComments : mixed
- $aContents : mixed
- $iLineNo : mixed
- __construct() : mixed
- Document constructor.
- __toString() : mixed
- addComments() : mixed
- append() : mixed
- Append item to list of contents.
- createShorthands() : mixed
- Create shorthands properties whenever possible
- expandShorthands() : mixed
- Expands all shorthand properties to their long value
- getAllDeclarationBlocks() : mixed
- Gets all DeclarationBlock objects recursively.
- getAllRuleSets() : mixed
- Returns all RuleSet objects found recursively in the tree.
- getAllSelectors() : mixed
- getAllValues() : mixed
- Returns all Value objects found recursively in the tree.
- getComments() : array<string|int, mixed>
- getContents() : mixed
- getLineNo() : int
- getSelectorsBySpecificity() : mixed
- Returns all Selector objects found recursively in the tree.
- isRootList() : mixed
- parse() : mixed
- parseList() : mixed
- prepend() : mixed
- Prepend item to list of contents.
- remove() : bool
- Removes an item from the CSS list.
- removeDeclarationBlockBySelector() : mixed
- Removes a declaration block from the CSS list if it matches all given selectors.
- render() : mixed
- replace() : mixed
- Replaces an item from the CSS list.
- setComments() : mixed
- setContents() : mixed
- Set the contents.
- splice() : mixed
- Splice the list of contents.
- allDeclarationBlocks() : mixed
- allRuleSets() : mixed
- allSelectors() : mixed
- allValues() : mixed
- identifierIs() : mixed
- Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed. We need to check for these versions too.
- parseAtRule() : mixed
- parseListItem() : mixed
Properties
$aComments
protected
mixed
$aComments
$aContents
protected
mixed
$aContents
$iLineNo
protected
mixed
$iLineNo
Methods
__construct()
Document constructor.
public
__construct(int $iLineNo) : mixed
Parameters
- $iLineNo : int
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —addComments()
public
addComments(array<string|int, mixed> $aComments) : mixed
Parameters
- $aComments : array<string|int, mixed>
-
Array of comments.
Return values
mixed —append()
Append item to list of contents.
public
append(object $oItem) : mixed
Parameters
- $oItem : object
-
Item.
Return values
mixed —createShorthands()
Create shorthands properties whenever possible
public
createShorthands() : mixed
Return values
mixed —expandShorthands()
Expands all shorthand properties to their long value
public
expandShorthands() : mixed
Return values
mixed —getAllDeclarationBlocks()
Gets all DeclarationBlock objects recursively.
public
getAllDeclarationBlocks() : mixed
Return values
mixed —getAllRuleSets()
Returns all RuleSet objects found recursively in the tree.
public
getAllRuleSets() : mixed
Return values
mixed —getAllSelectors()
public
getAllSelectors() : mixed
Tags
Return values
mixed —getAllValues()
Returns all Value objects found recursively in the tree.
public
getAllValues([(object|string) $mElement = null ][, (bool) $bSearchInFunctionArguments = false ]) : mixed
Parameters
- $mElement : (object|string) = null
-
the CSSList or RuleSet to start the search from (defaults to the whole document). If a string is given, it is used as rule name filter (@see{RuleSet->getRules()}).
- $bSearchInFunctionArguments : (bool) = false
-
whether to also return Value objects used as Function arguments.
Return values
mixed —getComments()
public
getComments() : array<string|int, mixed>
Return values
array<string|int, mixed> —getContents()
public
getContents() : mixed
Return values
mixed —getLineNo()
public
getLineNo() : int
Return values
int —getSelectorsBySpecificity()
Returns all Selector objects found recursively in the tree.
public
getSelectorsBySpecificity([ $sSpecificitySearch = null ]) : mixed
Note that this does not yield the full DeclarationBlock that the selector belongs to (and, currently, there is no way to get to that).
Parameters
- $sSpecificitySearch : = null
-
An optional filter by specificity. May contain a comparison operator and a number or just a number (defaults to "==").
Tags
Return values
mixed —isRootList()
public
isRootList() : mixed
Return values
mixed —parse()
public
static parse(ParserState $oParserState) : mixed
Parameters
- $oParserState : ParserState
Return values
mixed —parseList()
public
static parseList(ParserState $oParserState, CSSList $oList) : mixed
Parameters
- $oParserState : ParserState
- $oList : CSSList
Return values
mixed —prepend()
Prepend item to list of contents.
public
prepend(object $oItem) : mixed
Parameters
- $oItem : object
-
Item.
Return values
mixed —remove()
Removes an item from the CSS list.
public
remove(RuleSet|Import|Charset|CSSList $oItemToRemove) : bool
Parameters
- $oItemToRemove : RuleSet|Import|Charset|CSSList
-
May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
Return values
bool —Whether the item was removed.
removeDeclarationBlockBySelector()
Removes a declaration block from the CSS list if it matches all given selectors.
public
removeDeclarationBlockBySelector(array<string|int, mixed>|string $mSelector[, bool $bRemoveAll = false ]) : mixed
Parameters
- $mSelector : array<string|int, mixed>|string
-
The selectors to match.
- $bRemoveAll : bool = false
-
Whether to stop at the first declaration block found or remove all blocks
Return values
mixed —render()
public
render([OutputFormat $oOutputFormat = null ]) : mixed
Parameters
- $oOutputFormat : OutputFormat = null
Return values
mixed —replace()
Replaces an item from the CSS list.
public
replace(mixed $oOldItem, mixed $oNewItem) : mixed
Parameters
- $oOldItem : mixed
- $oNewItem : mixed
Return values
mixed —setComments()
public
setComments(array<string|int, mixed> $aComments) : mixed
Parameters
- $aComments : array<string|int, mixed>
-
Array containing Comment objects.
Return values
mixed —setContents()
Set the contents.
public
setContents(array<string|int, mixed> $aContents) : mixed
Parameters
- $aContents : array<string|int, mixed>
-
Objects to set as content.
Return values
mixed —splice()
Splice the list of contents.
public
splice(int $iOffset[, int $iLength = null ][, array<string|int, RuleSet> $mReplacement = null ]) : mixed
Parameters
- $iOffset : int
-
Offset.
- $iLength : int = null
-
Length. Optional.
- $mReplacement : array<string|int, RuleSet> = null
-
Replacement. Optional.
Return values
mixed —allDeclarationBlocks()
protected
allDeclarationBlocks(mixed &$aResult) : mixed
Parameters
- $aResult : mixed
Return values
mixed —allRuleSets()
protected
allRuleSets(mixed &$aResult) : mixed
Parameters
- $aResult : mixed
Return values
mixed —allSelectors()
protected
allSelectors(mixed &$aResult[, mixed $sSpecificitySearch = null ]) : mixed
Parameters
- $aResult : mixed
- $sSpecificitySearch : mixed = null
Return values
mixed —allValues()
protected
allValues(mixed $oElement, mixed &$aResult[, mixed $sSearchString = null ][, mixed $bSearchInFunctionArguments = false ]) : mixed
Parameters
- $oElement : mixed
- $aResult : mixed
- $sSearchString : mixed = null
- $bSearchInFunctionArguments : mixed = false
Return values
mixed —identifierIs()
Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed. We need to check for these versions too.
private
static identifierIs(mixed $sIdentifier, mixed $sMatch) : mixed
Parameters
- $sIdentifier : mixed
- $sMatch : mixed
Return values
mixed —parseAtRule()
private
static parseAtRule(ParserState $oParserState) : mixed
Parameters
- $oParserState : ParserState
Return values
mixed —parseListItem()
private
static parseListItem(ParserState $oParserState, CSSList $oList) : mixed
Parameters
- $oParserState : ParserState
- $oList : CSSList