diff --git a/src/parse/patterns.js b/src/parse/patterns.js index 313f40a46415..8fea930aa68e 100644 --- a/src/parse/patterns.js +++ b/src/parse/patterns.js @@ -1 +1 @@ -export const whitespace = /\s/; +export const whitespace = /[ \t\r\n]/; diff --git a/test/generator/nbsp/_config.js b/test/generator/nbsp/_config.js new file mode 100644 index 000000000000..c09c14e7c413 --- /dev/null +++ b/test/generator/nbsp/_config.js @@ -0,0 +1,8 @@ +export default { + html: ` `, + + test ( assert, component, target ) { + const text = target.querySelector( 'span' ).textContent; + assert.equal( text.charCodeAt( 0 ), 160 ); + } +}; \ No newline at end of file diff --git a/test/generator/nbsp/main.html b/test/generator/nbsp/main.html new file mode 100644 index 000000000000..11cd588757a4 --- /dev/null +++ b/test/generator/nbsp/main.html @@ -0,0 +1 @@ +  \ No newline at end of file diff --git a/test/parser/nbsp/input.html b/test/parser/nbsp/input.html new file mode 100644 index 000000000000..11cd588757a4 --- /dev/null +++ b/test/parser/nbsp/input.html @@ -0,0 +1 @@ +  \ No newline at end of file diff --git a/test/parser/nbsp/output.json b/test/parser/nbsp/output.json new file mode 100644 index 000000000000..d8cbb594f6e9 --- /dev/null +++ b/test/parser/nbsp/output.json @@ -0,0 +1,27 @@ +{ + "hash": 2678229240, + "html": { + "start": 0, + "end": 19, + "type": "Fragment", + "children": [ + { + "start": 0, + "end": 19, + "type": "Element", + "name": "span", + "attributes": [], + "children": [ + { + "start": 6, + "end": 12, + "type": "Text", + "data": " " + } + ] + } + ] + }, + "css": null, + "js": null +} \ No newline at end of file