Skip to content

Commit

Permalink
fix(ng|vue): whitespaces between interpolation and text are sensitive (
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Nov 9, 2018
1 parent b0b5460 commit 1bce579
Show file tree
Hide file tree
Showing 4 changed files with 2,103 additions and 15 deletions.
16 changes: 16 additions & 0 deletions src/language-html/utils.js
Expand Up @@ -137,6 +137,14 @@ function isLeadingSpaceSensitiveNode(node) {
return false;
}

if (
(node.type === "text" || node.type === "interpolation") &&
node.prev &&
(node.prev.type === "text" || node.prev.type === "interpolation")
) {
return true;
}

if (!node.parent || node.parent.cssDisplay === "none") {
return false;
}
Expand Down Expand Up @@ -177,6 +185,14 @@ function isTrailingSpaceSensitiveNode(node) {
return false;
}

if (
(node.type === "text" || node.type === "interpolation") &&
node.next &&
(node.next.type === "text" || node.next.type === "interpolation")
) {
return true;
}

if (!node.parent || node.parent.cssDisplay === "none") {
return false;
}
Expand Down

0 comments on commit 1bce579

Please sign in to comment.