parent
0691662fd4
commit
622e009811
3 changed files with 25 additions and 1 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
- API: Event handlers, when set to literally `undefined` (or any non-function), are now correctly removed.
|
- API: Event handlers, when set to literally `undefined` (or any non-function), are now correctly removed.
|
||||||
- core: `xlink:href` attributes are now correctly removed
|
- core: `xlink:href` attributes are now correctly removed
|
||||||
- core: render() function can no longer prevent from changing `document.activeElement` in lifecycle hooks
|
- core: render() function can no longer prevent from changing `document.activeElement` in lifecycle hooks
|
||||||
|
- render: fixed an ommission that caused `oninit` to be called unnecessarily in some cases [#1992](https://github.com/MithrilJS/mithril.js/issues/1992)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ module.exports = function($window) {
|
||||||
if (oldIndex != null) {
|
if (oldIndex != null) {
|
||||||
var movable = old[oldIndex]
|
var movable = old[oldIndex]
|
||||||
var shouldRecycle = (pool != null && oldIndex >= old.length - pool.length) || ((pool == null) && recycling)
|
var shouldRecycle = (pool != null && oldIndex >= old.length - pool.length) || ((pool == null) && recycling)
|
||||||
updateNode(parent, movable, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), recycling, ns)
|
updateNode(parent, movable, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)
|
||||||
insertNode(parent, toFragment(movable), nextSibling)
|
insertNode(parent, toFragment(movable), nextSibling)
|
||||||
old[oldIndex].skip = true
|
old[oldIndex].skip = true
|
||||||
if (movable.dom != null) nextSibling = movable.dom
|
if (movable.dom != null) nextSibling = movable.dom
|
||||||
|
|
|
||||||
|
|
@ -199,4 +199,27 @@ o.spec("oninit", function() {
|
||||||
o(vnode.dom.oninit).equals(undefined)
|
o(vnode.dom.oninit).equals(undefined)
|
||||||
o(vnode.dom.attributes["oninit"]).equals(undefined)
|
o(vnode.dom.attributes["oninit"]).equals(undefined)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
o("No spurious oninit calls in mapped keyed diff when the pool is involved (#1992)", function () {
|
||||||
|
var oninit1 = o.spy()
|
||||||
|
var oninit2 = o.spy()
|
||||||
|
var oninit3 = o.spy()
|
||||||
|
|
||||||
|
render(root, [
|
||||||
|
{tag: "p", key: 1, attrs: {oninit: oninit1}},
|
||||||
|
{tag: "p", key: 2, attrs: {oninit: oninit2}},
|
||||||
|
{tag: "p", key: 3, attrs: {oninit: oninit3}},
|
||||||
|
])
|
||||||
|
render(root, [
|
||||||
|
{tag: "p", key: 1, attrs: {oninit: oninit1}},
|
||||||
|
{tag: "p", key: 3, attrs: {oninit: oninit3}},
|
||||||
|
])
|
||||||
|
render(root, [
|
||||||
|
{tag: "p", key: 3, attrs: {oninit: oninit3}},
|
||||||
|
])
|
||||||
|
|
||||||
|
o(oninit1.callCount).equals(1)
|
||||||
|
o(oninit2.callCount).equals(1)
|
||||||
|
o(oninit3.callCount).equals(1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue