Properly update event handler and value in array event listeners

pull/2/head
paldepind 10 years ago
parent 39926a9cfb
commit 529fdde299

@ -16,6 +16,7 @@ function updateEventListeners(oldVnode, vnode) {
} else if (is.array(old)) {
old[0] = cur[0]; // Deliberately modify old array since it's
old[1] = cur[1]; // captured in closure created with `arrInvoker`
on[name] = old;
}
}
}

@ -424,11 +424,16 @@ describe('snabbdom', function() {
var vnode2 = h('div', {on: {click: [clicked, 2]}}, [
h('a', 'Click my parent'),
]);
var vnode3 = h('div', {on: {click: [clicked, 3]}}, [
h('a', 'Click my parent'),
]);
patch(vnode0, vnode1);
elm.click();
patch(vnode1, vnode2);
elm.click();
assert.deepEqual(result, [1, 2]);
patch(vnode2, vnode3);
elm.click();
assert.deepEqual(result, [1, 2, 3]);
});
});
describe('hooks', function() {

Loading…
Cancel
Save