omi v4.1.5 - solve the problem of having children attribute but not updating it.

This commit is contained in:
dntzhang 2018-11-18 10:39:09 +08:00
parent 926eddb381
commit 360ee83cf7
10 changed files with 29 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/**
* omi v4.1.4 http://omijs.org
* omi v4.1.5 http://omijs.org
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
@ -465,7 +465,7 @@
}
// Apply attributes/props from VNode to the DOM Element:
diffAttributes(out, vnode.attributes, props);
diffAttributes(out, vnode.attributes, props, vnode.children);
if (out.props) {
out.props.children = vnode.children;
}
@ -602,7 +602,7 @@
* @param {Object} attrs The desired end-state key-value attribute pairs
* @param {Object} old Current/previous attributes (from previous VNode or element's prop cache)
*/
function diffAttributes(dom, attrs, old) {
function diffAttributes(dom, attrs, old, children) {
var name;
var update = false;
var isWeElement = dom.update;
@ -633,7 +633,11 @@
}
}
dom.parentNode && update && isWeElement && dom.update();
if (isWeElement && dom.parentNode) {
if (update || children.length > 0) {
dom.update();
}
}
}
/*!
@ -1458,7 +1462,7 @@
};
options.root.Omi = omi;
options.root.Omi.version = '4.1.4';
options.root.Omi.version = '4.1.5';
if (typeof module != 'undefined') module.exports = omi;else self.Omi = omi;
}());

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/**
* omi v4.1.4 http://omijs.org
* omi v4.1.5 http://omijs.org
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
@ -462,7 +462,7 @@ function idiff(dom, vnode, context, mountAll, componentRoot) {
}
// Apply attributes/props from VNode to the DOM Element:
diffAttributes(out, vnode.attributes, props);
diffAttributes(out, vnode.attributes, props, vnode.children);
if (out.props) {
out.props.children = vnode.children;
}
@ -599,7 +599,7 @@ function removeChildren(node) {
* @param {Object} attrs The desired end-state key-value attribute pairs
* @param {Object} old Current/previous attributes (from previous VNode or element's prop cache)
*/
function diffAttributes(dom, attrs, old) {
function diffAttributes(dom, attrs, old, children) {
var name;
var update = false;
var isWeElement = dom.update;
@ -630,7 +630,11 @@ function diffAttributes(dom, attrs, old) {
}
}
dom.parentNode && update && isWeElement && dom.update();
if (isWeElement && dom.parentNode) {
if (update || children.length > 0) {
dom.update();
}
}
}
/*!
@ -1455,7 +1459,7 @@ var omi = {
};
options.root.Omi = omi;
options.root.Omi.version = '4.1.4';
options.root.Omi.version = '4.1.5';
export default omi;
export { tag, WeElement, Component, render, h, h as createElement, options, define, observe, cloneElement, getHost, rpx, tick, nextTick };

File diff suppressed because one or more lines are too long

View File

@ -187,7 +187,7 @@
if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) {
if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0];
} else if (vchildren && vchildren.length || null != fc) if ('WeElement' != out.constructor.is || !out.constructor.noSlot) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML);
diffAttributes(out, vnode.attributes, props);
diffAttributes(out, vnode.attributes, props, vnode.children);
if (out.props) out.props.children = vnode.children;
isSvgMode = prevSvgMode;
return out;
@ -238,7 +238,7 @@
node = next;
}
}
function diffAttributes(dom, attrs, old) {
function diffAttributes(dom, attrs, old, children) {
var name;
var update = !1;
var isWeElement = dom.update;
@ -259,7 +259,7 @@
update = !0;
}
}
dom.parentNode && update && isWeElement && dom.update();
if (isWeElement && dom.parentNode) if (update || children.length > 0) dom.update();
}
function tick(fn, scope) {
callbacks.push({
@ -838,7 +838,7 @@
nextTick: nextTick
};
options.root.Omi = omi;
options.root.Omi.version = '4.1.4';
options.root.Omi.version = '4.1.5';
if ('undefined' != typeof module) module.exports = omi; else self.Omi = omi;
}();
//# sourceMappingURL=omi.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "omi",
"version": "4.1.4",
"version": "4.1.5",
"description": "Next generation web framework.",
"main": "dist/omi.js",
"jsnext:main": "dist/omi.esm.js",

View File

@ -30,7 +30,7 @@ const omi = {
}
options.root.Omi = omi
options.root.Omi.version = '4.1.4'
options.root.Omi.version = '4.1.5'
export default omi