diff --git a/src/Parser.js b/src/Parser.js index f276521..a637b84 100644 --- a/src/Parser.js +++ b/src/Parser.js @@ -1,5 +1,5 @@ import {COMMENT, RULESET, DECLARATION} from './Enum.js' -import {abs, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js' +import {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js' import {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js' /** @@ -43,7 +43,7 @@ export function parse (value, root, parent, rule, rules, rulesets, pseudo, point switch (previous = character, character = next()) { // ( case 40: - if (previous != 108 && characters.charCodeAt(length - 1) == 58) { + if (previous != 108 && charat(characters, length - 1) == 58) { if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break diff --git a/src/Utility.js b/src/Utility.js index a27883b..702fe6e 100644 --- a/src/Utility.js +++ b/src/Utility.js @@ -22,7 +22,7 @@ export var assign = Object.assign * @return {number} */ export function hash (value, length) { - return (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) + return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0 } /** diff --git a/test/Prefixer.js b/test/Prefixer.js index 23ea154..ffb361d 100644 --- a/test/Prefixer.js +++ b/test/Prefixer.js @@ -271,4 +271,8 @@ describe('Prefixer', () => { test('tab-size', () => { expect(prefix(`tab-size:1;`, 8)).to.equal([`-moz-tab-size:1;`, `tab-size:1;`].join('')) }) + + test('css variables', () => { + expect(prefix(`--CircularProgress-animation:0.5s linear;`, 28)).to.equal('--CircularProgress-animation:0.5s linear;') + }) })