Skip to content

Commit

Permalink
Fix backslash-escapes in url()s (#1429)
Browse files Browse the repository at this point in the history
Closes #1399
  • Loading branch information
nex3 committed Aug 11, 2021
1 parent 54d16c0 commit 5f4994e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Allow `if` to be used as an unquoted string.

* Properly parse backslash escapes within `url()` expressions.

### Command Line Interface

* Strip CRLF newlines from snippets of the original stylesheet that are included
Expand Down
4 changes: 2 additions & 2 deletions lib/src/parse/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,14 @@ class Parser {
var next = scanner.peekChar();
if (next == null) {
break;
} else if (next == $backslash) {
buffer.write(escape());
} else if (next == $percent ||
next == $ampersand ||
next == $hash ||
(next >= $asterisk && next <= $tilde) ||
next >= 0x0080) {
buffer.writeCharCode(scanner.readChar());
} else if (next == $backslash) {
buffer.write(escape());
} else if (isWhitespace(next)) {
whitespace();
if (scanner.peekChar() != $rparen) break;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2911,14 +2911,14 @@ abstract class StylesheetParser extends Parser {
var next = scanner.peekChar();
if (next == null) {
break;
} else if (next == $backslash) {
buffer.write(escape());
} else if (next == $exclamation ||
next == $percent ||
next == $ampersand ||
(next >= $asterisk && next <= $tilde) ||
next >= 0x0080) {
buffer.writeCharCode(scanner.readChar());
} else if (next == $backslash) {
buffer.write(escape());
} else if (next == $hash) {
if (scanner.peekChar(1) == $lbrace) {
buffer.add(singleInterpolation());
Expand Down

0 comments on commit 5f4994e

Please sign in to comment.