JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<span>
<span id="test"><span class="test"></span></span>
<span class="test"></span>
<span id="goat"><span></span></span>
</span>
</div>
JavaScript
var noID = $('*:not([id])');
var noClass = $('*:not([class])');
var withSpace = $('*:not([id]) *:not([class])');
var noSpace= $('*:not([id]):not([class])');
console.log(withSpace.length);
console.log(noSpace.length);
noSpace.each(function() {
console.log($(this));
});