mirror of https://github.com/sveltejs/svelte
Merge e86e2c7cd5 into 05a3bce6bb
commit
5ccea320c2
@ -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