Skip to content

Commit 42b4d15

Browse files
committed
feat(parser): no skip parse text simbols
1 parent 00858b4 commit 42b4d15

File tree

6 files changed

+7
-94
lines changed

6 files changed

+7
-94
lines changed

lib/parser.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ function toTree (html) {
5555
last.content.push(buf);
5656
},
5757
ontext: function(text) {
58-
if (text.match(/(^[\s\n]+$)/g)) return;
59-
60-
text = text.trim();
61-
6258
let last = bufArray.last();
6359
if (!last) {
6460
results.push(text);

test/classes.js

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,88 +16,13 @@ describe('Parse classes', () => {
1616
test(html, html, done);
1717
});
1818

19-
it('block', done => {
19+
it('block1', done => {
2020
let html = '<div class="block1">text</div>';
2121
test(html, html, done);
2222
});
2323

24-
it('block_modname', done => {
25-
let html = '<div class="block1 block1_modname">text</div>';
26-
test(html, html, done);
27-
});
28-
29-
it('block_modname_modval', done => {
30-
let html = '<div class="block1 block1_modname_modval">text</div>';
31-
test(html, html, done);
32-
});
33-
34-
it('mix blocks', done => {
24+
it('block1 block2', done => {
3525
let html = '<div class="block1 block2">text</div>';
3626
test(html, html, done);
3727
});
38-
39-
it('mix block1 block2_modname', done => {
40-
let html = '<div class="block1 block2 block2_modname">text</div>';
41-
test(html, html, done);
42-
});
43-
44-
it('mix block1_modname block2_modname', done => {
45-
let html = '<div class="block1 block1_modname block2 block2_modname">text</div>';
46-
test(html, html, done);
47-
});
48-
49-
it('mix block1 block2_modname_modval', done => {
50-
let html = '<div class="block1 block2 block2_modname_modval">text</div>';
51-
test(html, html, done);
52-
});
53-
54-
it('mix block1_modval_modname block2_modname_modval', done => {
55-
let html = '<div class="block1 block1_modname_modval block2 block2_modname_modval">text</div>';
56-
test(html, html, done);
57-
});
58-
59-
it('block__elem', done => {
60-
let html = '<div class="block1"><div class="block1__elem">text</div></div>';
61-
test(html, html, done);
62-
});
63-
64-
it('block__elem_modname', done => {
65-
let html = '<div class="block1"><div class="block1__elem block1__elem_modname">text</div></div>';
66-
test(html, html, done);
67-
});
68-
69-
it('block__elem_modname_modval', done => {
70-
let html = '<div class="block1"><div class="block1__elem block1__elem_modname_modval">text</div></div>';
71-
test(html, html, done);
72-
});
73-
74-
it('mix elems', done => {
75-
let html = '<div class="block1 block2"><div class="block1__elem block2__elem">text</div></div>';
76-
test(html, html, done);
77-
});
78-
79-
it('mix block1__elem block2__elem_modname', done => {
80-
let html = '<div class="block1 block2"><div class="block1__elem block2__elem block2__elem_modname">text</div></div>';
81-
test(html, html, done);
82-
});
83-
84-
it('mix block1__elem_modname block2__elem_modname', done => {
85-
let html = '<div class="block1 block2"><div class="block1__elem block1__elem_modval block2__elem block2__elem_modname">text</div></div>';
86-
test(html, html, done);
87-
});
88-
89-
it('mix block1__elem block2__elem_modname_modval', done => {
90-
let html = '<div class="block1 block2"><div class="block1__elem block2__elem block2__elem_modname_modval">text</div></div>';
91-
test(html, html, done);
92-
});
93-
94-
it('mix block1__elem_modname_modval block2__elem_modname_modval', done => {
95-
let html = '<div class="block1 block2"><div class="block1__elem block1__elem_modname_modval block2__elem block2__elem_modname_modval">text</div></div>';
96-
test(html, html, done);
97-
});
98-
99-
it('block1__elem__elem', done => {
100-
let html = '<div class="block1__elem__elem">text</div>';
101-
test(html, html, done);
102-
});
10328
});

test/comments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* jshint mocha: true, maxlen: false */
22
import posthtml from '../index.js';
33
import { expect } from 'chai';
4-
import { minifer, file } from '../util/test.js';
4+
import { file } from '../util/test.js';
55

6-
const comments = minifer(file('templates/comments.html'));
6+
const comments = file('templates/comments.html');
77

88
function test(html, reference, done) {
99
posthtml().process(html).then(result => {

test/doctype.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* jshint mocha: true, maxlen: false */
22
import posthtml from '../index.js';
33
import { expect } from 'chai';
4-
import { minifer, file } from '../util/test.js';
4+
import { file } from '../util/test.js';
55

6-
const doctype = minifer(file('templates/doctype.html'));
7-
const html = minifer(file('templates/html.html'));
6+
const doctype = file('templates/doctype.html');
7+
const html = file('templates/html.html');
88

99
function test(html, reference, done) {
1010
posthtml().process(html).then(result => {

test/options.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ describe('Set options', () => {
1818
test(beforeHTML, done);
1919
});
2020

21-
it('minifer \\n', done => {
22-
test('<div class="button">\n<rect/>\n<div class="button__text">Text</div>\n</div>', done);
23-
});
24-
2521
});
2622

2723
describe('Skip html parsing & use tree from options.', () => {

test/test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@ describe('Simple text', () => {
1717
test(beforeHTML, done);
1818
});
1919

20-
it('minifer \\n', done => {
21-
test('<div class="button">\n<div class="button__text">Text</div>\n</div>', done);
22-
});
23-
2420
});

0 commit comments

Comments
 (0)