Skip to content

Commit 855b157

Browse files
committed
Changes suggested in code review
1 parent 140abca commit 855b157

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Please also have a look at our
4040

4141
### Removed
4242

43-
- Remove the IE hack in `Rule` (#995))
43+
- Remove the IE hack in `Rule` (#995)
4444
- Drop `getLineNo()` from the `Renderable` interface (#1038)
4545
- Remove `OutputFormat::level()` (#874)
4646
- Remove expansion of shorthand properties (#838)

src/Rule/Rule.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ public static function parse(ParserState $parserState): Rule
8686
$parserState->consume(':');
8787
$value = Value::parseValue($parserState, self::listDelimiterForRule($rule->getRule()));
8888
$rule->setValue($value);
89-
if ($parserState->getSettings()->usesLenientParsing()) {
90-
while ($parserState->comes('\\')) {
91-
$parserState->consume('\\');
92-
$parserState->consume();
93-
$parserState->consumeWhiteSpace();
94-
}
95-
}
9689
$parserState->consumeWhiteSpace();
9790
if ($parserState->comes('!')) {
9891
$parserState->consume('!');

tests/ParserTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,28 @@ public function unexpectedTokenExceptionLineNo(): void
10361036
}
10371037
}
10381038

1039+
/**
1040+
* @test
1041+
*/
1042+
public function ieHacksCauseExceptionInStrictMode(): void
1043+
{
1044+
$this->expectException(UnexpectedTokenException::class);
1045+
1046+
self::parsedStructureForFile('ie-hacks', Settings::create()->beStrict());
1047+
}
1048+
1049+
/**
1050+
* @test
1051+
*/
1052+
public function ieHacksArePartiallyRemovedInLenientMode(): void
1053+
{
1054+
$document = self::parsedStructureForFile('ie-hacks', Settings::create()->withLenientParsing(true));
1055+
1056+
$expected = 'p {padding-right: .75rem;background-image: none;color: red;'
1057+
. 'background-color: red;background-color: red;content: "red \\0";content: "red઼";}';
1058+
self::assertSame($expected, $document->render());
1059+
}
1060+
10391061
/**
10401062
* @depends files
10411063
*

tests/fixtures/ie-hacks.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
p {
2+
padding-right: .75rem \9;
3+
background-image: none \9;
4+
color:red\9\0;
5+
background-color:red \9 \0;
6+
background-color:red \9 \0 !important;
7+
content: "red \9\0";
8+
content: "red\0abc";
9+
}

0 commit comments

Comments
 (0)