diff --git a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts b/src/compile/render-dom/wrappers/Element/StyleAttribute.ts index b0a3663c63..43524ff372 100644 --- a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts +++ b/src/compile/render-dom/wrappers/Element/StyleAttribute.ts @@ -122,7 +122,7 @@ function get_style_value(chunks: Node[]) { } else if (char === '\\') { escaped = true; } else if (char === quote_mark) { - quote_mark === null; + quote_mark = null; } else if (char === '"' || char === "'") { quote_mark = char; } else if (char === ')' && in_url) { @@ -173,4 +173,4 @@ function get_style_value(chunks: Node[]) { function is_dynamic(value: Node[]) { return value.length > 1 || value[0].type !== 'Text'; -} \ No newline at end of file +} diff --git a/test/runtime/samples/attribute-url/_config.js b/test/runtime/samples/attribute-url/_config.js new file mode 100644 index 0000000000..28bc1bcb0c --- /dev/null +++ b/test/runtime/samples/attribute-url/_config.js @@ -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' ); + } +}; diff --git a/test/runtime/samples/attribute-url/main.svelte b/test/runtime/samples/attribute-url/main.svelte new file mode 100644 index 0000000000..357a352aaa --- /dev/null +++ b/test/runtime/samples/attribute-url/main.svelte @@ -0,0 +1,6 @@ + + +
{color}