Your implementation of the replace modifier behaviour is ok, however, when I suggested this I was of the impression that it would clear the contents of the target then become its only child instead of destroying the target. I think we can call this new feature i just mentioned here clear so that it is different in a sense and leave replace doing what you just made it do.
It could do it this way; in fact I had implemented virtually all of this functionality. Just having a few bugs here and there (in the remove function)
so it could just do this:
let child;
while((child = parentNode.firstChild)) {
child.remove()
}
Your implementation of the
replace
modifier behaviour is ok, however, when I suggested this I was of the impression that it would clear the contents of the target then become its only child instead of destroying the target. I think we can call this new feature i just mentioned hereclear
so that it is different in a sense and leave replace doing what you just made it do. It could do it this way; in fact I had implemented virtually all of this functionality. Just having a few bugs here and there (in the remove function) so it could just do this:before it becomes the only child.