Skip to content

Commit

Permalink
Allow nonstandard attribute modifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseppstein committed Mar 27, 2018
1 parent 313a9a0 commit 7b49c55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/__tests__/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,6 @@ test('comments within attribute selectors (4)', '[ /*before*/ href /* after-attr
t.is(attr.raws.value, undefined);
});

// test('attributes with escapes', '[ng\\:cloak]', (t, tree) => {
// t.deepEqual(tree.toString(), '[ng\\:cloak]');
// });
test('non standard modifiers', '[href="foo" y]', (t, tree) => {
t.deepEqual(tree.toString(), '[href="foo" y]');
});
10 changes: 7 additions & 3 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,13 @@ export default class Parser {
node.raws.value = (oldRawValue || oldValue) + content;
}
lastAdded = 'value';
} else if (content === 'i') {
} else {
let insensitive = (content === 'i');
if (node.value && (node.quoteMark || spaceAfterMeaningfulToken)) {
node.insensitive = true;
if (!insensitive) {
node.raws.insensitiveFlag = content;
}
lastAdded = 'insensitive';
if (spaceBefore) {
ensureObject(node, 'spaces', 'insensitive');
Expand All @@ -264,9 +268,9 @@ export default class Parser {
}
} else if (node.value) {
lastAdded = 'value';
node.value += 'i';
node.value += content;
if (node.raws.value) {
node.raws.value += 'i';
node.raws.value += content;
}
}
}
Expand Down

0 comments on commit 7b49c55

Please sign in to comment.