diff --git a/.gitignore b/.gitignore index 1967750..b00cb24 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ coverage node_modules dist .idea +.vscode \ No newline at end of file diff --git a/src/__tests__/tags.js b/src/__tests__/tags.js index d405a62..4253c36 100644 --- a/src/__tests__/tags.js +++ b/src/__tests__/tags.js @@ -36,3 +36,8 @@ test('tag with attribute', 'label[for="email"]', (t, tree) => { t.deepEqual(tree.nodes[0].nodes[1].type, 'attribute'); t.deepEqual(tree.nodes[0].nodes[1].quoteMark, '"'); }); + +test('keyframes animation tag selector', '0.00%', (t, tree) => { + t.deepEqual(tree.nodes[0].nodes[0].value, '0.00%'); + t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); +}); diff --git a/src/parser.js b/src/parser.js index 64859c2..26c773f 100644 --- a/src/parser.js +++ b/src/parser.js @@ -836,7 +836,13 @@ export default class Parser { } nextToken = this.nextToken; } - const hasClass = indexesOf(word, '.').filter(i => word[i - 1] !== '\\'); + const hasClass = indexesOf(word, '.').filter(i => { + // Allow escaped dot within class name + const escapedDot = word[i - 1] === '\\'; + // Allow decimal numbers percent in @keyframes + const isKeyframesPercent = /^\d+\.\d+%$/.test(word); + return !escapedDot && !isKeyframesPercent; + }); let hasId = indexesOf(word, '#').filter(i => word[i - 1] !== '\\'); // Eliminate Sass interpolations from the list of id indexes const interpolations = indexesOf(word, '#{');