{} creates an empty object but which still contains methods and properties like toString. Checking changes[key] when the key is for instance toString creates false positives in that check.
I was looking whether into whether this caused bugs, but in practice, the algorithms in _VirtualDom_insertNode and _VirtualDom_removeNode end up with the correct behavior because they recurse with a modified key, but do so with an unnecessary iteration.
Object.create(null) creates an empty object without any methods or properties, leading to no false positives and one less unnecessary iteration.
This is a minor improvement pull request.
{}
creates an empty object but which still contains methods and properties liketoString
. Checkingchanges[key]
when the key is for instancetoString
creates false positives in that check.I was looking whether into whether this caused bugs, but in practice, the algorithms in
_VirtualDom_insertNode
and_VirtualDom_removeNode
end up with the correct behavior because they recurse with a modified key, but do so with an unnecessary iteration.Object.create(null)
creates an empty object without any methods or properties, leading to no false positives and one less unnecessary iteration.