Skip to content

Commit 75a77fe

Browse files
authored
Merge pull request #2754 from EmilTholin/reset-quote-mark
Set quote_mark to null when closing quote mark is found
2 parents c67f534 + 97184b7 commit 75a77fe

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/compile/render-dom/wrappers/Element/StyleAttribute.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function get_style_value(chunks: Node[]) {
122122
} else if (char === '\\') {
123123
escaped = true;
124124
} else if (char === quote_mark) {
125-
quote_mark === null;
125+
quote_mark = null;
126126
} else if (char === '"' || char === "'") {
127127
quote_mark = char;
128128
} else if (char === ')' && in_url) {
@@ -173,4 +173,4 @@ function get_style_value(chunks: Node[]) {
173173

174174
function is_dynamic(value: Node[]) {
175175
return value.length > 1 || value[0].type !== 'Text';
176-
}
176+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
test({ assert, target }) {
3+
const div = target.querySelector( 'div' );
4+
5+
assert.equal( div.style.backgroundImage, 'url(https://example.com/foo.jpg)');
6+
assert.equal( div.style.color, 'red' );
7+
}
8+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script>
2+
let bgImage = 'https://example.com/foo.jpg';
3+
let color = 'red';
4+
</script>
5+
6+
<div style="background-image: url('{bgImage}'); color: {color};">{color}</div>

0 commit comments

Comments
 (0)