[IMP] vdom: performance improvement

Port from original snabbdom project: snabbdom/snabbdom#634

The issue is that before this commit, the removeClass method was
sometimes called even if it is not useful. See this comment for more
detail: https://github.com/snabbdom/snabbdom/issues/633#issue-618706258
This commit is contained in:
Pierre Paridans
2021-07-06 10:39:51 +02:00
committed by Géry Debongnie
parent ad42c583c6
commit 9cfafc30b5
+2 -1
View File
@@ -231,7 +231,8 @@ function updateClass(oldVnode: VNode, vnode: VNode): void {
elm = vnode.elm as Element;
for (name in oldClass) {
if (name && !klass[name]) {
if (name && !klass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
// was `true` and now not provided
elm.classList.remove(name);
}
}