mirror of https://github.com/sveltejs/svelte
Merge e86e2c7cd5 into 5895c637b0
commit
1b9875ebad
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: strip trailing semicolons in style directive reactive updates
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
import { assert_ok, test } from '../../assert';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<div style="color: red;"></div>`,
|
||||||
|
|
||||||
|
test({ assert, target, window, component }) {
|
||||||
|
const div = target.querySelector('div');
|
||||||
|
assert_ok(div);
|
||||||
|
|
||||||
|
// Initial value with trailing semicolon — should produce valid CSS
|
||||||
|
assert.equal(window.getComputedStyle(div).color, 'rgb(255, 0, 0)');
|
||||||
|
|
||||||
|
// Update to a new value that also has a trailing semicolon
|
||||||
|
component.color = 'blue;';
|
||||||
|
assert.equal(window.getComputedStyle(div).color, 'rgb(0, 0, 255)');
|
||||||
|
|
||||||
|
// Update to a value without trailing semicolon — should still work
|
||||||
|
component.color = 'green';
|
||||||
|
assert.equal(window.getComputedStyle(div).color, 'rgb(0, 128, 0)');
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let color = 'red;';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div style:color={color}></div>
|
||||||
Loading…
Reference in new issue