diff --git a/src/parser/model/ParserHtml.js b/src/parser/model/ParserHtml.js index db1a771b7..aba3846a9 100644 --- a/src/parser/model/ParserHtml.js +++ b/src/parser/model/ParserHtml.js @@ -118,9 +118,8 @@ define(function(require) { var parsed = this.parseNode(node); // From:
TEST
<-- span is text type // TO:
TEST
<-- div become text type - // With 'nodeChild > 1' I know that nodes were merged if(parsed.length == 1 && parsed[0].type == 'text' && - nodeChild > 1 && parsed[0].tagName == TEXT_NODE){ + parsed[0].tagName == TEXT_NODE){ model.type = 'text'; model.content = parsed[0].content; }else diff --git a/test/specs/parser/model/ParserHtml.js b/test/specs/parser/model/ParserHtml.js index 5573ea22e..d88c5fb12 100644 --- a/test/specs/parser/model/ParserHtml.js +++ b/test/specs/parser/model/ParserHtml.js @@ -12,6 +12,7 @@ define([path + 'model/ParserHtml', path + 'model/ParserCss', 'DomComponents'], var dom = new DomComponents(); obj = new ParserHtml({ textTags: ['br', 'b', 'i', 'u'], + pStylePrefix: 'gjs-', }); obj.compTypes = dom.componentTypes; }); @@ -62,6 +63,12 @@ define([path + 'model/ParserHtml', path + 'model/ParserCss', 'DomComponents'], obj.parseClass(str).should.deep.equal(result); }); + it('Parse class string to array with special classes', function() { + var str = 'test1 test2 test3 test-4 gjs-test'; + var result = ['test1', 'test2', 'test3', 'test-4']; + obj.parseClass(str).should.deep.equal(result); + }); + it('Style attribute is isolated', function() { var str = '
'; var result = { @@ -219,10 +226,6 @@ define([path + 'model/ParserHtml', path + 'model/ParserCss', 'DomComponents'], tagName: 'article', attributes: {id: 'test1'}, components: [{ - content: ' ', - type: 'textnode', - tagName: '' - },{ tagName: 'div' },{ content: ' ', @@ -278,11 +281,7 @@ define([path + 'model/ParserHtml', path + 'model/ParserCss', 'DomComponents'], },{ tagName: 'div', type: 'text', - components: [{ - tagName: 'span', - type: 'text', - content: 'nested', - }] + content: 'nested', },{ tagName: '', type: 'textnode',