Skip to content

Commit 50929e2

Browse files
committed
Pseudo classes cannot have a space after the : char
1 parent 9dc957b commit 50929e2

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/Property/Selector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Selector
4646
/ix';
4747

4848
/**
49-
* regexp for specificity calculations
49+
* regexp for validity verifications
5050
*
5151
* @var string
5252
*
@@ -79,7 +79,7 @@ class Selector
7979
*/
8080
public static function isValid($sSelector)
8181
{
82-
return \preg_match(static::SELECTOR_VALIDATION_RX, $sSelector);
82+
return \preg_match(static::SELECTOR_VALIDATION_RX, $sSelector) && \strpos($sSelector, ': ') === false;
8383
}
8484

8585
/**

tests/ParserTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,11 @@ public function invalidSelectorsInFile(): void
787787
html[dir="rtl"] .super-menu > li:last-of-type {border-left-width: 0;}}
788788
body {background-color: red;}';
789789
self::assertSame($sExpected, $oDoc->render());
790+
791+
$oDoc = self::parsedStructureForFile('invalid-selectors-3', Settings::create()->withMultibyteSupport(true));
792+
$sExpected = 'body, div :hover {color: green;}
793+
div {color: blue;}';
794+
self::assertSame($sExpected, $oDoc->render());
790795
}
791796

792797
/**
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
body, div: hover {
2+
color: green;
3+
}
4+
5+
body, div : hover {
6+
color: green;
7+
}
8+
9+
body, div :hover {
10+
color: green;
11+
}
12+
13+
div {
14+
color: blue;
15+
}

0 commit comments

Comments
 (0)