Skip to content

Commit ce6178d

Browse files
committedMar 7, 2017
differentiate between nbsp and other whitespace (#348)
1 parent d8dbe4e commit ce6178d

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed
 

‎src/parse/patterns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const whitespace = /\s/;
1+
export const whitespace = /[ \t\r\n]/;

‎test/generator/nbsp/_config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
html: `<span>&nbsp;</span>`,
3+
4+
test ( assert, component, target ) {
5+
const text = target.querySelector( 'span' ).textContent;
6+
assert.equal( text.charCodeAt( 0 ), 160 );
7+
}
8+
};

‎test/generator/nbsp/main.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span>&nbsp;</span>

‎test/parser/nbsp/input.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span>&nbsp;</span>

‎test/parser/nbsp/output.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"hash": 2678229240,
3+
"html": {
4+
"start": 0,
5+
"end": 19,
6+
"type": "Fragment",
7+
"children": [
8+
{
9+
"start": 0,
10+
"end": 19,
11+
"type": "Element",
12+
"name": "span",
13+
"attributes": [],
14+
"children": [
15+
{
16+
"start": 6,
17+
"end": 12,
18+
"type": "Text",
19+
"data": " "
20+
}
21+
]
22+
}
23+
]
24+
},
25+
"css": null,
26+
"js": null
27+
}

0 commit comments

Comments
 (0)