diff --git a/index.js b/index.js index b950bb8..8491702 100644 --- a/index.js +++ b/index.js @@ -191,7 +191,7 @@ module.exports = function(css, options){ if (!m) return; /* @fix Remove all comments from selectors * http://ostermiller.org/findcomment.html */ - return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').split(/\s*,\s*/); + return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').split(/\s*(?![^(]*\)),\s*/); } /** diff --git a/test/cases/ms-lang.css b/test/cases/ms-lang.css new file mode 100644 index 0000000..44d37de --- /dev/null +++ b/test/cases/ms-lang.css @@ -0,0 +1,3 @@ +foo:-ms-lang(ar, dv, fa, he, ku-Arab, pa-Arab, prs, ps, sd-Arab, syr, ug, ur, qps-plocm) { + bar: 'baz'; +} \ No newline at end of file diff --git a/test/cases/ms-lang.json b/test/cases/ms-lang.json new file mode 100644 index 0000000..d455cbe --- /dev/null +++ b/test/cases/ms-lang.json @@ -0,0 +1,42 @@ +{ + "type": "stylesheet", + "stylesheet": { + "rules": [ + { + "type": "rule", + "selectors": [ + "foo:-ms-lang(ar, dv, fa, he, ku-Arab, pa-Arab, prs, ps, sd-Arab, syr, ug, ur, qps-plocm)" + ], + "declarations": [ + { + "type": "declaration", + "property": "bar", + "value": "'baz'", + "position": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 13 + }, + "source": "ms-lang.css" + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + }, + "source": "ms-lang.css" + } + } + ] + } +} \ No newline at end of file diff --git a/test/css-parse.js b/test/css-parse.js index 81312b1..9b5cba1 100644 --- a/test/css-parse.js +++ b/test/css-parse.js @@ -18,6 +18,9 @@ describe('parse(str)', function(){ var css = read(path.join('test', 'cases', file + '.css'), 'utf8'); var json = read(path.join('test', 'cases', file + '.json'), 'utf8'); var ret = parse(css, { source: file + '.css' }); + // Normalize line endings from input file + json = JSON.parse(json); + json = JSON.stringify(json, null, 2); ret = JSON.stringify(ret, null, 2); ret.should.equal(json); })