File tree 3 files changed +27
-1
lines changed
src/compiler/compile/nodes
test/runtime/samples/nbsp-div
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export default class Text extends Node {
12
12
super ( component , parent , scope , info ) ;
13
13
this . data = info . data ;
14
14
15
- if ( ! component . component_options . preserveWhitespace && ! / \S / . test ( info . data ) ) {
15
+ if ( ! component . component_options . preserveWhitespace && ! / [ \S \u00A0 ] / . test ( info . data ) ) {
16
16
let node = parent ;
17
17
while ( node ) {
18
18
if ( node . type === 'Element' && node . name === 'pre' ) {
Original file line number Diff line number Diff line change
1
+ export default {
2
+ html : `<div> hello</div>
3
+ <div> hello </div>
4
+ <div> hello hello</div>` ,
5
+
6
+ test ( { assert, component, target } ) {
7
+ var divList = target . querySelectorAll ( 'div' )
8
+ assert . equal ( divList [ 0 ] . textContent . charCodeAt ( 0 ) , 160 ) ;
9
+ assert . equal ( divList [ 1 ] . textContent . charCodeAt ( 0 ) , 160 ) ;
10
+ assert . equal ( divList [ 1 ] . textContent . charCodeAt ( 6 ) , 160 ) ;
11
+ assert . equal ( divList [ 1 ] . textContent . charCodeAt ( 7 ) , 160 ) ;
12
+ assert . equal ( divList [ 2 ] . textContent . charCodeAt ( 0 ) , 160 ) ;
13
+ assert . equal ( divList [ 2 ] . textContent . charCodeAt ( 6 ) , 160 ) ;
14
+ assert . equal ( divList [ 2 ] . textContent . charCodeAt ( 7 ) , 32 ) ; //normal space
15
+ assert . equal ( divList [ 2 ] . textContent . charCodeAt ( 8 ) , 160 ) ;
16
+
17
+
18
+ }
19
+ } ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ let name = ' hello' ;
3
+ </script >
4
+
5
+ <div > {name }</div >
6
+ <div > {name } </div >
7
+ <div > {name } {name }</div >
You can’t perform that action at this time.
0 commit comments