From 31ea4397a4beed31b1fe7d5d5f0d9acd142f864b Mon Sep 17 00:00:00 2001 From: Vlad Florescu Date: Tue, 25 Jul 2017 17:44:41 +0300 Subject: [PATCH 1/2] fix style parsing bug for attributes containing colon --- src/parser/model/ParserHtml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/model/ParserHtml.js b/src/parser/model/ParserHtml.js index 7e1ccc63e..8ef0a52ad 100644 --- a/src/parser/model/ParserHtml.js +++ b/src/parser/model/ParserHtml.js @@ -25,7 +25,7 @@ module.exports = config => { if(!decl) continue; var prop = decl.split(':'); - result[prop[0].trim()] = prop[1].trim(); + result[prop[0].trim()] = prop.slice(1).join(':').trim(); } return result; }, From cec81ebb7fd55801609c28c0fc9198d77a583b99 Mon Sep 17 00:00:00 2001 From: Vlad Florescu Date: Thu, 10 Aug 2017 15:22:59 +0300 Subject: [PATCH 2/2] test style parsing for attributes containing colon --- test/specs/parser/model/ParserHtml.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/specs/parser/model/ParserHtml.js b/test/specs/parser/model/ParserHtml.js index acbcefad8..a77cd6663 100644 --- a/test/specs/parser/model/ParserHtml.js +++ b/test/specs/parser/model/ParserHtml.js @@ -57,6 +57,16 @@ module.exports = { expect(obj.parseStyle(str)).toEqual(result) }); + it('Parse style string with values containing colon to object', () => { + var str = 'background-image:url("https://some-website.ex"); test:value;'; + var result = { + 'background-image': 'url("https://some-website.ex")', + 'test': 'value', + }; + expect(obj.parseStyle(str)).toEqual(result) + }); + + it('Parse class string to array', () => { var str = 'test1 test2 test3 test-4'; var result = ['test1', 'test2', 'test3', 'test-4'];