html: keep track of the open elements (tree construction)