This use of replace all is incorrect.
"replace all" replaces all children of an element. Here it's replacing all children of an element with the children of the element, resulting in no change.
Instead, it should be following steps similar to replaceWith.