File tree Expand file tree Collapse file tree 6 files changed +2280
-9
lines changed Expand file tree Collapse file tree 6 files changed +2280
-9
lines changed Original file line number Diff line number Diff line change 3
3
! .npmignore
4
4
! .travis.yml
5
5
6
+ dist /
6
7
node_modules /
7
8
8
9
bundle.js
9
- yarn.lock
Original file line number Diff line number Diff line change 3
3
/*
4
4
benchmark the speed of the different methods to create elements
5
5
Not all tests are equally functional but it gives a good idea of what to expect from
6
- the different techniques .
6
+ the different methods .
7
7
*/
8
8
9
9
var benchmark = require ( 'benchmark' )
@@ -23,11 +23,13 @@ var el = parse(XML)
23
23
var suite = new benchmark . Suite ( 'ltx' )
24
24
25
25
suite . add ( 'tag with template literal' , function ( ) {
26
+ /* eslint-disable */
26
27
tag `
27
28
<message to="${ 'foo@bar' } " from="${ 'bar@foo' } " type="${ 'chat' } " id="${ 'foobar' } ">
28
29
<body>${ 'Where there is love there is life.' } </body>
29
30
</message>
30
31
`
32
+ /* eslint-enable */
31
33
} )
32
34
33
35
suite . add ( 'tag with direct call' , function ( ) {
Original file line number Diff line number Diff line change 15
15
" Sonny Piers"
16
16
],
17
17
"license" : " MIT" ,
18
- "engine" : " node" ,
19
18
"scripts" : {
20
19
"prepublish" : " npm run bundle" ,
21
20
"preversion" : " npm test" ,
22
21
"benchmark" : " node benchmarks/" ,
23
- "bundle" : " browserify -s ltx index.js -o bundle.js" ,
22
+ "bundle" : " browserify -s ltx index.js -o bundle.js && cp bundle.js dist/ltx.js " ,
24
23
"unit" : " vows --spec" ,
25
24
"lint" : " standard" ,
26
25
"test" : " npm run unit && npm run lint && npm run bundle"
29
28
"inherits" : " ^2.0.1"
30
29
},
31
30
"devDependencies" : {
32
- "benchmark" : " ^2.1.0 " ,
33
- "browserify" : " ^13.0.1 " ,
34
- "libxmljs" : " ^0.18.0 " ,
31
+ "benchmark" : " ^2.1.3 " ,
32
+ "browserify" : " ^14.1.0 " ,
33
+ "libxmljs" : " ^0.18.4 " ,
35
34
"microtime" : " ^2.1.2" ,
36
35
"node-expat" : " ^2.3.13" ,
37
36
"node-xml" : " ^1.0.2" ,
38
- "sax" : " ^1.1.5 " ,
39
- "standard" : " ^8.5 .0" ,
37
+ "sax" : " ^1.2.2 " ,
38
+ "standard" : " ^9.0 .0" ,
40
39
"vows" : " ^0.8.1"
41
40
}
42
41
}
Original file line number Diff line number Diff line change @@ -35,5 +35,31 @@ vows.describe('stringify').addBatch({
35
35
36
36
assert . equal ( stringify ( el , 2 ) , expected )
37
37
assert . equal ( stringify ( el , ' ' ) , expected )
38
+ } ,
39
+ 'ignores empty string children' : function ( ) {
40
+ const el = {
41
+ name : 'foo' ,
42
+ attrs : { } ,
43
+ children : [ '' , 'bar' , '' ]
44
+ }
45
+ assert . equal ( stringify ( el ) , '<foo>bar</foo>' )
46
+ } ,
47
+ 'ignores deep empty string children' : function ( ) {
48
+ const el = {
49
+ name : 'foo' ,
50
+ attrs : { } ,
51
+ children : [
52
+ '' ,
53
+ {
54
+ name : 'bar' ,
55
+ attrs : { } ,
56
+ children : [
57
+ '' , '' , ''
58
+ ]
59
+ } ,
60
+ ''
61
+ ]
62
+ }
63
+ assert . equal ( stringify ( el ) , '<foo><bar></bar></foo>' )
38
64
}
39
65
} ) . export ( module )
You can’t perform that action at this time.
0 commit comments