Subtree Directives Not Working - Issue Fix
Fixed mithril not aborting the diff algorithm for the {subtree:retain}
node.
This commit is contained in:
parent
80f43c260b
commit
50d678dfdf
1 changed files with 2 additions and 1 deletions
|
|
@ -448,7 +448,7 @@ var m = (function app(window, undefined) {
|
||||||
//Faster to coerce to number and check for NaN
|
//Faster to coerce to number and check for NaN
|
||||||
var key = +(data && data.attrs && data.attrs.key);
|
var key = +(data && data.attrs && data.attrs.key);
|
||||||
data = pendingRequests === 0 || forcing || cachedControllers && cachedControllers.indexOf(controller) > -1 ? data.view(controller) : {tag: "placeholder"};
|
data = pendingRequests === 0 || forcing || cachedControllers && cachedControllers.indexOf(controller) > -1 ? data.view(controller) : {tag: "placeholder"};
|
||||||
if (data.subtree === "retain") return cached;
|
if (data.subtree === "retain") return data;
|
||||||
if (key === key) (data.attrs = data.attrs || {}).key = key;
|
if (key === key) (data.attrs = data.attrs || {}).key = key;
|
||||||
updateLists(views, controllers, view, controller);
|
updateLists(views, controllers, view, controller);
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -463,6 +463,7 @@ var m = (function app(window, undefined) {
|
||||||
function buildObject(data, cached, editable, parentElement, index, shouldReattach, namespace, configs) {
|
function buildObject(data, cached, editable, parentElement, index, shouldReattach, namespace, configs) {
|
||||||
var views = [], controllers = [];
|
var views = [], controllers = [];
|
||||||
data = markViews(data, cached, views, controllers);
|
data = markViews(data, cached, views, controllers);
|
||||||
|
if (data.subtree === "retain") return cached;
|
||||||
if (!data.tag && controllers.length) throw new Error("Component template must return a virtual element, not an array, string, etc.");
|
if (!data.tag && controllers.length) throw new Error("Component template must return a virtual element, not an array, string, etc.");
|
||||||
data.attrs = data.attrs || {};
|
data.attrs = data.attrs || {};
|
||||||
cached.attrs = cached.attrs || {};
|
cached.attrs = cached.attrs || {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue