early-out for self-swap
check for invalid children
style consistency
cherry-pick from swapChildren
err...