clean to traverse all elements, inner and outer detection.  Also detect block elements, and flatten them
Upstream