mirror of https://github.com/sveltejs/svelte
fix: always set draggable through `setAttribute` to avoid weird behavior (#12649)
Closes #12643 Very weird behaviour from the draggable setter...if you set element.draggable="false" it will actually set draggable to true (the boolean).animation-params
parent
e417d3a2d2
commit
32c4e47060
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: always set draggable through `setAttribute` to avoid weird behavior
|
@ -0,0 +1,17 @@
|
||||
import { ok, test } from '../../test';
|
||||
import { flushSync } from 'svelte';
|
||||
|
||||
export default test({
|
||||
html: `<div draggable="false"></div><div draggable="false"></div>`,
|
||||
|
||||
async test({ assert, target, logs }) {
|
||||
const [div, div2] = target.querySelectorAll('div');
|
||||
ok(div);
|
||||
ok(div2);
|
||||
|
||||
assert.deepEqual(div.getAttribute('draggable'), 'false');
|
||||
assert.deepEqual(div.draggable, false);
|
||||
assert.deepEqual(div2.getAttribute('draggable'), 'false');
|
||||
assert.deepEqual(div2.draggable, false);
|
||||
}
|
||||
});
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
let attrs = $state({ draggable: 'false' });
|
||||
</script>
|
||||
|
||||
<svelte:element this={'div'} draggable="false"></svelte:element>
|
||||
|
||||
<div {...attrs}></div>
|
Loading…
Reference in new issue