JSFiddle - React, Tailwind, and code Playground
HTML
<mark class=obj><u><a>т</a><strike><b>уп</b><a>и</a></strike><a>к</a></u></mark>
<div id=w></div>
JavaScript
var obj = document.querySelector('.obj')
getChildren(obj)
function getChildren(obj, collection = []) {
let children = [...obj.childNodes]
return collection.concat(
children,
children.reduce(
(collection, child) => collection.concat(getChildren(child)), collection
)
)
}
console.log(getChildren(obj))
w.textContent = obj.textContent