Skip to content

Commit 01a6b34

Browse files
committed
Fixes a crash when a backslash is the last character.
1 parent 341b79a commit 01a6b34

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.1.1
2+
3+
* Fixes a crash when a backslash ended a selector string.
4+
15
# 1.1.0
26

37
* Adds support for replacing multiple nodes at once with `replaceWith`

src/__tests__/tags.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ test('tag with trailing comma', 'h1,', (t, tree) => {
2828
t.plan(1);
2929
t.equal(tree.trailingComma, true);
3030
});
31+
32+
test('tag with trailing slash', 'h1\\', (t, tree) => {
33+
t.plan(1);
34+
t.equal(tree.nodes[0].nodes[0].value, 'h1\\');
35+
});

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export default class Parser {
208208
word += current;
209209
if (current.lastIndexOf('\\') === current.length - 1) {
210210
let next = this.nextToken;
211-
if (next[0] === 'space') {
211+
if (next && next[0] === 'space') {
212212
word += next[1];
213213
this.position ++;
214214
}

0 commit comments

Comments
 (0)