Skip to content

Commit

Permalink
Merge pull request #352 from sveltejs/gh-348
Browse files Browse the repository at this point in the history
differentiate between nbsp and other whitespace
  • Loading branch information
Rich-Harris authored Mar 7, 2017
2 parents 93b0b0e + ce6178d commit a362b43
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse/patterns.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const whitespace = /\s/;
export const whitespace = /[ \t\r\n]/;
8 changes: 8 additions & 0 deletions test/generator/nbsp/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
html: `<span>&nbsp;</span>`,

test ( assert, component, target ) {
const text = target.querySelector( 'span' ).textContent;
assert.equal( text.charCodeAt( 0 ), 160 );
}
};
1 change: 1 addition & 0 deletions test/generator/nbsp/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span>&nbsp;</span>
1 change: 1 addition & 0 deletions test/parser/nbsp/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span>&nbsp;</span>
27 changes: 27 additions & 0 deletions test/parser/nbsp/output.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a362b43

Please sign in to comment.