fix(5018): compare wholeText instead of data (#5028)

pull/5130/head
Bassam Ismail 5 years ago committed by GitHub
parent 62345432ac
commit ce3d0461e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -73,7 +73,7 @@ export function dataset_dev(node: HTMLElement, property: string, value?: any) {
export function set_data_dev(text, data) {
data = '' + data;
if (text.data === data) return;
if (text.wholeText === data) return;
dispatch_dev("SvelteDOMSetData", { node: text, data });
text.data = data;

@ -193,7 +193,7 @@ export function claim_space(nodes) {
export function set_data(text, data) {
data = '' + data;
if (text.data !== data) text.data = data;
if (text.wholeText !== data) text.data = data;
}
export function set_input_value(input, value) {

@ -0,0 +1,15 @@
export default {
html: `
<div contenteditable=""></div>
`,
async test({ assert, component, target, window }) {
const div = target.querySelector('div');
const text = window.document.createTextNode('a');
div.insertBefore(text, null);
const event = new window.InputEvent('input');
await div.dispatchEvent(event);
assert.equal(div.textContent, 'a');
}
};

@ -0,0 +1,6 @@
<script>
let text = '';
const updater = (event) => {text = event.target.textContent}
</script>
<div contenteditable on:input={updater}>{text}</div>
Loading…
Cancel
Save