Depth traversal is usually the easiest traversal style since you can do it recursively or with an explicit stack; in the first case, a queue is required, which in a sense is a more complex data structure. But I think there is a simpler answer than tradition or simplicity: a depth search in the (X) HTML tree causes the text nodes to intersect in the order of presentation.
Consider this relatively simple HTML subtree.
Or in raw form:
<p>Consider this <emph>relatively</emph> simple <a href="...">HTML</a> subtree</p>
Like a tree (excluding spaces and attributes):
<P> | +-----------+----+----+-----+------+ ______|______ __|___ ___|__ _|_ ___|___ Consider this <EMPH> simple <A> subtree | | ____|_____ __|__ relatively HTML
Depth Trace:
<P>, Consider this, <EMPH>, relatively, simple, <A>, HTML, subtree
First step:
<P>, Consider this, <EMPH>, simple, <A>, subtree, relatively, HTML
source share