File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
lib/Sabberworm/CSS/Parsing Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,11 @@ public function parseIdentifier($bIgnoreCase = true) {
5555 }
5656 $ sCharacter = null ;
5757 while (($ sCharacter = $ this ->parseCharacter (true )) !== null ) {
58- $ sResult .= $ sCharacter ;
58+ if (preg_match ('/[a-zA-Z0-9\x{00A0}-\x{FFFF}_-]/Sux ' , $ sCharacter )) {
59+ $ sResult .= $ sCharacter ;
60+ } else {
61+ $ sResult .= '\\' . $ sCharacter ;
62+ }
5963 }
6064 if ($ bIgnoreCase ) {
6165 $ sResult = $ this ->strtolower ($ sResult );
Original file line number Diff line number Diff line change @@ -466,6 +466,12 @@ function testSelectorEscapesInFile() {
466466 $ this ->assertSame ($ sExpected , $ oDoc ->render ());
467467 }
468468
469+ function testIdentifierEscapesInFile () {
470+ $ oDoc = $ this ->parsedStructureForFile ('identifier-escapes ' , Settings::create ()->withMultibyteSupport (true ));
471+ $ sExpected = 'div {font: 14px Font Awesome\ 5 Pro;font: 14px Font Awesome\} 5 Pro;font: 14px Font Awesome\; 5 Pro;f\;ont: 14px Font Awesome\; 5 Pro;} ' ;
472+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
473+ }
474+
469475 function testSelectorIgnoresInFile () {
470476 $ oDoc = $ this ->parsedStructureForFile ('selector-ignores ' , Settings::create ()->withMultibyteSupport (true ));
471477 $ sExpected = '.some[selectors-may= \'contain-a-{ \'] {}
Original file line number Diff line number Diff line change 1+ div {
2+ font : 14px Font Awesome\ 5 Pro;
3+ font : 14px Font Awesome\} 5 Pro;
4+ font: 14px Font Awesome\; 5 Pro;
5+ f\;ont: 14px Font Awesome\; 5 Pro;
6+ }
You can’t perform that action at this time.
0 commit comments