File tree Expand file tree Collapse file tree 3 files changed +14
-31
lines changed Expand file tree Collapse file tree 3 files changed +14
-31
lines changed Original file line number Diff line number Diff line change
1
+ import config from '../config'
1
2
import { parseText } from './text-parser'
2
3
import { isArray } from '../util/index'
3
4
@@ -25,7 +26,7 @@ function genElement (el, key) {
25
26
}
26
27
27
28
function genIf ( el , exp ) {
28
- return `(${ exp } ) ? ${ genElement ( el ) } : '' `
29
+ return `(${ exp } ) ? ${ genElement ( el ) } : null `
29
30
}
30
31
31
32
function genFor ( el , exp ) {
@@ -101,7 +102,6 @@ function genData (el, key) {
101
102
if ( hasEvents ) {
102
103
data += genEvents ( events )
103
104
}
104
- console . log ( data )
105
105
return data . replace ( / , $ / , '' ) + '}'
106
106
}
107
107
Original file line number Diff line number Diff line change
1
+ import config from '../config'
2
+
1
3
/**
2
4
* Convert HTML string to AST
3
5
*
@@ -37,8 +39,14 @@ export function parse (html) {
37
39
chars ( text ) {
38
40
text = currentParent . tag === 'pre'
39
41
? text
40
- : text . trim ( ) ? text : ' '
41
- currentParent . children . push ( text )
42
+ : text . trim ( )
43
+ ? text
44
+ : config . preserveWhiteSpace
45
+ ? ' '
46
+ : null
47
+ if ( text ) {
48
+ currentParent . children . push ( text )
49
+ }
42
50
}
43
51
} )
44
52
return root
Original file line number Diff line number Diff line change 1
1
export default {
2
2
3
3
/**
4
- * Whether to print debug messages.
5
- * Also enables stack trace for warnings.
6
- *
7
- * @type {Boolean }
4
+ * Preserve whitespaces between elements.
8
5
*/
9
6
10
- debug : false ,
7
+ preserveWhiteSpace : true ,
11
8
12
9
/**
13
10
* Whether to suppress warnings.
@@ -17,35 +14,13 @@ export default {
17
14
18
15
silent : false ,
19
16
20
- /**
21
- * Whether to use async rendering.
22
- */
23
-
24
- async : true ,
25
-
26
17
/**
27
18
* Whether to warn against errors caught when evaluating
28
19
* expressions.
29
20
*/
30
21
31
22
warnExpressionErrors : true ,
32
23
33
- /**
34
- * Whether to allow devtools inspection.
35
- * Disabled by default in production builds.
36
- */
37
-
38
- devtools : process . env . NODE_ENV !== 'production' ,
39
-
40
- /**
41
- * Internal flag to indicate the delimiters have been
42
- * changed.
43
- *
44
- * @type {Boolean }
45
- */
46
-
47
- _delimitersChanged : true ,
48
-
49
24
/**
50
25
* List of asset types that a component can own.
51
26
*
You can’t perform that action at this time.
0 commit comments