Skip to content

Commit

Permalink
fix: double quotes not allowed in attribute value
Browse files Browse the repository at this point in the history
close #2250
  • Loading branch information
johnsoncodehk committed Dec 25, 2022
1 parent 6310e81 commit bf32696
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -1192,7 +1192,8 @@ export function generate(
}
}
function writeAttrValue(attrNode: CompilerDOM.TextNode) {
codeGen.push('"');
const char = attrNode.loc.source.startsWith("'") ? "'" : '"';
codeGen.push(char);
let start = attrNode.loc.start.offset;
let end = attrNode.loc.end.offset;
let content = attrNode.loc.source;
Expand All @@ -1210,7 +1211,7 @@ export function generate(
[start, end],
getCaps(capabilitiesSet.all),
]);
codeGen.push('"');
codeGen.push(char);
}
}
function writeInlineCss(node: CompilerDOM.ElementNode) {
Expand Down
5 changes: 5 additions & 0 deletions vue-language-tools/vue-test-workspace/vue-tsc/#2250/main.vue
@@ -0,0 +1,5 @@
<template>
<input type="text" placeholder='Example: "something"'>
<input type="text" placeholder="Example: 'something'">
<input type="text" placeholder=Example:something>
</template>

0 comments on commit bf32696

Please sign in to comment.