JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<span></span>
<ul>
<li></li>
</ul>
</div>
<img>
<p></p>
JavaScript
$("body").find("*").each(function(){
document.write( this.nodeName.toLowerCase() + "<br>" )
if( $(this).children().length > 0 ){
$(this).children().each(function(){
document.write( "<ul>" );
document.write( "<li>" + this.nodeName.toLowerCase() + "</li>" );
document.write( "</ul>" );
});
}
});