Skip to content

Commit 9310a87

Browse files
committed
Merge branch 'fix/more-invalid-selector-fixes' into testing-2022
2 parents 4535fca + 09eff5f commit 9310a87

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
*/
@@ -77,7 +77,7 @@ class Selector
7777
*/
7878
public static function isValid($sSelector)
7979
{
80-
return preg_match(static::SELECTOR_VALIDATION_RX, $sSelector);
80+
return preg_match(static::SELECTOR_VALIDATION_RX, $sSelector) && strpos($sSelector, ': ') === false;
8181
}
8282

8383
/**

tests/ParserTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ public function invalidSelectorsInFile()
821821
$sExpected = '#test {color: #fff;}
822822
@media only screen and (max-width:30000px) {#test2 {color: #fff;}}';
823823
self::assertSame($sExpected, $oDoc->render());
824+
825+
$oDoc = self::parsedStructureForFile('invalid-selectors-4', Settings::create()->withMultibyteSupport(true));
826+
$sExpected = 'body, div :hover {color: green;}
827+
div {color: blue;}';
828+
self::assertSame($sExpected, $oDoc->render());
824829
}
825830

826831
/**
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)