Skip to content

Commit 4ea4fd6

Browse files
committed
Add percentage matching since keyframe steps are treated as regular selectors
1 parent a06e5bb commit 4ea4fd6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Sabberworm/CSS/Property/Selector.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ class Selector {
4141
private $iSpecificity;
4242

4343
public static function isValid($sSelector) {
44-
return preg_match("/^[a-zA-Z0-9\x{00A0}-\x{FFFF}_\^\$\|\*\=\"\'\~\[\]\(\)\-\s\.:#\+\>]*$/u", $sSelector);
44+
return preg_match("/^([a-zA-Z0-9\x{00A0}-\x{FFFF}_\^\$\|\*\=\"\'\~\[\]\(\)\-\s\.:#\+\>]*|\s*?[\+-]?\d+\%\s*)$/u", $sSelector);
4545
}
4646

4747
public function __construct($sSelector, $bCalculateSpecificity = false) {
4848
if (!Selector::isValid($sSelector)) {
49-
preg_match("/[^a-zA-Z0-9\x{00A0}-\x{FFFF}_\^\$\|\*\=\"\'\~\[\]\(\)\-\s\.:#\+\>]/u", $sSelector, $matches);
50-
throw new UnexpectedTokenException("Selector did not match '/^[a-zA-Z0-9\x{00A0}-\x{FFFF}_\^\$\|\*\=\"\'\~\[\]\(\)\-\s\.:#\+\>]*$/u'. ({$matches[0]} found).", $sSelector, "custom");
49+
throw new UnexpectedTokenException("Selector did not match '/^([a-zA-Z0-9\x{00A0}-\x{FFFF}_\^\$\|\*\=\"\'\~\[\]\(\)\-\s\.:#\+\>]*|\s*?[\+-]?\d+\%\s*)$/u'.", $sSelector, "custom");
5150
}
5251
$this->setSelector($sSelector);
5352
if ($bCalculateSpecificity) {

0 commit comments

Comments
 (0)