replaced the previous node.outerHTML algorithm with a iterative depth-first search.

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>