private function CssParser::pseudoClass in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/CssParser.php \CssParser::pseudoClass()
- 7.2 QueryPath/CssParser.php \CssParser::pseudoClass()
1 call to CssParser::pseudoClass()
- CssParser::simpleSelectors in QueryPath/
CssParser.php
File
- QueryPath/
CssParser.php, line 268
Class
Code
private function pseudoClass($restricted = FALSE) {
if ($this->DEBUG) {
print "PSEUDO-CLASS\n";
}
if ($this->scanner->token == CssToken::colon) {
$isPseudoElement = FALSE;
if ($this->scanner
->nextToken() === CssToken::colon) {
$isPseudoElement = TRUE;
$this->scanner
->nextToken();
}
$name = $this->scanner
->getNameString();
if ($restricted && $name == 'not') {
throw new CssParseException("The 'not' pseudo-class is illegal in this context.");
}
$value = NULL;
if ($this->scanner->token == CssToken::lparen) {
if ($isPseudoElement) {
throw new CssParseException("Illegal left paren. Pseudo-Element cannot have arguments.");
}
$value = $this
->pseudoClassValue();
}
if ($isPseudoElement) {
if ($restricted) {
throw new CssParseException("Pseudo-Elements are illegal in this context.");
}
$this->handler
->pseudoElement($name);
$this
->consumeWhitespace();
if ($this->scanner->token !== FALSE && $this->scanner->token !== CssToken::comma) {
throw new CssParseException("A Pseudo-Element must be the last item in a selector.");
}
}
else {
$this->handler
->pseudoClass($name, $value);
}
}
}