fix: Add more checks to determine if element is non-static (#15259)

Fixes #15241
pull/15320/head
Ranjan Purbey 7 months ago committed by GitHub
parent 073f4d8911
commit 575900de88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure input elements and elements with `dir` attribute are marked as non-static

@ -144,6 +144,17 @@ function is_static_element(node, state) {
return false;
}
if (attribute.name === 'dir') {
return false;
}
if (
['input', 'textarea'].includes(node.name) &&
['value', 'checked'].includes(attribute.name)
) {
return false;
}
if (node.name === 'option' && attribute.name === 'value') {
return false;
}

@ -0,0 +1,9 @@
import { test } from '../../test';
export default test({
test(assert, target) {
const p = target.querySelector('p');
assert.equal(p?.dir, 'rtl');
}
});

@ -0,0 +1,9 @@
import { test } from '../../test';
export default test({
test(assert, target) {
const input = target.querySelector('input');
assert.equal(input?.checked, true);
}
});
Loading…
Cancel
Save