I'm curious if there is an easy way to make this transition with JavaScript.
<div>
<i>
<b>
TEXT
</b>
</i>
</div>
To this:
<div>
<b>
<i>
TEXT
</i>
</b>
</div>
Now I know that this is possible in longer ways, like creating a new <b>
and <i>
, placing all of old <b>
inside of new <i>
, and then new <i>
inside of the new <b>
, and then replace the child, or similar method. But I'm curious if there's something like node.swapTypeWithParent
or swapNodeTypes(b, i)
.