Suppose I do the following:
var elems = document.querySelectorAll('div *');
where div
is some arbitrary div, like the following:
<div>
<select>
<option>Opt1</option>
<option>Opt1</option>
<option>Opt1</option>
<optgroup>
<option>Opt1</option>
<option>Opt1</option>
<option>Opt1</option>
</optgroup>
</select>
</div>
My question now is, what will elems
be? Did the Javascript standard specify a way on doing these, or is this just left to the implementors.
Other way of putting it, How does Javascript traverse the nodes. Will it traverse it in a DFS (Depth first seach) manner in which I'm guaranteed a perfectly flattened nodes?