From 294a2180a4d793d5b7c95fe79c81bf595fea3391 Mon Sep 17 00:00:00 2001 From: Andrej Shakhraj Date: Sun, 9 Oct 2016 15:50:04 +0300 Subject: [PATCH] fix parsing of parentheses in quotes --- lib/parse/index.js | 2 +- test/cases/quoted/ast.json | 4 ++-- test/cases/quoted/compressed.css | 2 +- test/cases/quoted/input.css | 2 +- test/cases/quoted/output.css | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/parse/index.js b/lib/parse/index.js index 053f0596..07740f68 100644 --- a/lib/parse/index.js +++ b/lib/parse/index.js @@ -224,7 +224,7 @@ module.exports = function(css, options){ if (!match(/^:\s*/)) return error("property missing ':'"); // val - var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); + var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((:?'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^\)]*?)\)|[^};])+)/); var ret = pos({ type: 'declaration', diff --git a/test/cases/quoted/ast.json b/test/cases/quoted/ast.json index 8b3d6001..a14dfd5a 100644 --- a/test/cases/quoted/ast.json +++ b/test/cases/quoted/ast.json @@ -11,7 +11,7 @@ { "type": "declaration", "property": "background", - "value": "url('some;stuff;here') 50% 50% no-repeat", + "value": "url('some;stuff();here') 50% 50% no-repeat", "position": { "start": { "line": 2, @@ -19,7 +19,7 @@ }, "end": { "line": 2, - "column": 55 + "column": 57 }, "source": "input.css" } diff --git a/test/cases/quoted/compressed.css b/test/cases/quoted/compressed.css index dd590eaa..3638d826 100644 --- a/test/cases/quoted/compressed.css +++ b/test/cases/quoted/compressed.css @@ -1 +1 @@ -body{background:url('some;stuff;here') 50% 50% no-repeat;} +body{background:url('some;stuff();here') 50% 50% no-repeat;} diff --git a/test/cases/quoted/input.css b/test/cases/quoted/input.css index db593220..6206ba65 100644 --- a/test/cases/quoted/input.css +++ b/test/cases/quoted/input.css @@ -1,3 +1,3 @@ body { - background: url('some;stuff;here') 50% 50% no-repeat; + background: url('some;stuff();here') 50% 50% no-repeat; } diff --git a/test/cases/quoted/output.css b/test/cases/quoted/output.css index db593220..6206ba65 100644 --- a/test/cases/quoted/output.css +++ b/test/cases/quoted/output.css @@ -1,3 +1,3 @@ body { - background: url('some;stuff;here') 50% 50% no-repeat; + background: url('some;stuff();here') 50% 50% no-repeat; }