lib/preact.rb in isomorfeus-preact-22.10.0.rc1 vs lib/preact.rb in isomorfeus-preact-22.10.0.rc2

- old
+ new

@@ -969,10 +969,17 @@ let vnodeId = 0; const vnode_class = #{VNode}; function is_a_vnode(type) { return type === vnode_class; } function is_nil() { return false; } + function vnode_eql(me, other) { + for(let prop in me) { + if (prop === 'props') { continue; } + else if (me[prop] != other[prop]) { return false; } + } + return me.props["$=="](other.props); + } self.createVNode = function(type, props, key, ref, original) { // V8 seems to be better at detecting type shapes if the object is allocated from the same call site // Do not inline into createElement and coerceToVNode! let eql; @@ -991,22 +998,12 @@ // a _nextDom that has been set to `null` _nextDom: undefined, _component: null, _hydrating: null, constructor: undefined, - _original: original == null ? ++vnodeId : original, + _original: (original == null) ? ++vnodeId : original, "$is_a?": is_a_vnode, - "$==": eql = function(other) { - for(let prop in vnode) { - if (prop === 'props') { - let res = vnode[prop]["$=="](other[prop]); - if (!res) return false; - } else if (vnode[prop] != other[prop]) { - return false; - } - } - return true; - }, + "$==": eql = function(other) { return vnode_eql(vnode, other); }, "$eql?": eql, "$nil?": is_nil, "$$is_vnode": true };