Merge pull request #2754 from EmilTholin/reset-quote-mark

Set quote_mark to null when closing quote mark is found
pull/2782/head
Rich Harris 6 years ago committed by GitHub
commit 75a77fea22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,7 @@ function get_style_value(chunks: Node[]) {
} else if (char === '\\') { } else if (char === '\\') {
escaped = true; escaped = true;
} else if (char === quote_mark) { } else if (char === quote_mark) {
quote_mark === null; quote_mark = null;
} else if (char === '"' || char === "'") { } else if (char === '"' || char === "'") {
quote_mark = char; quote_mark = char;
} else if (char === ')' && in_url) { } else if (char === ')' && in_url) {
@ -173,4 +173,4 @@ function get_style_value(chunks: Node[]) {
function is_dynamic(value: Node[]) { function is_dynamic(value: Node[]) {
return value.length > 1 || value[0].type !== 'Text'; return value.length > 1 || value[0].type !== 'Text';
} }

@ -0,0 +1,8 @@
export default {
test({ assert, target }) {
const div = target.querySelector( 'div' );
assert.equal( div.style.backgroundImage, 'url(https://example.com/foo.jpg)');
assert.equal( div.style.color, 'red' );
}
};

@ -0,0 +1,6 @@
<script>
let bgImage = 'https://example.com/foo.jpg';
let color = 'red';
</script>
<div style="background-image: url('{bgImage}'); color: {color};">{color}</div>
Loading…
Cancel
Save