Per comment above, my suggestion would be something like:

```
var tagChanged = false;
if (currentElement.tag !== oldElement.tag) {
    tagChanged = true;
    generateTagEdit(edits, oldElement, currentElement);
}
if (tagChanged || (currentElement.childSignature !== oldElement.childSignatire) {
    generateChildEdits(currentElement, (tagChanged ? null : oldElement));
}
if (tagChanged || (currentElement.subtreeSignature !== oldElement.subtreeSignature)) {
    currentElement.children.forEach(queuePush);
}
```