Some cleanup + trace dom range identification

* Refactored some common code.

* After wasting an hour tracing a non-bug after being confused by
  different tables marked by identical about-ids, fixed trace
  output to prominently emit tag-ids for tables so it is clear
  that different table elements are being examined.

* Added tracing for finding DOM ranges and marked a potential
  bug with a FIXME.

Change-Id: I19ac27f57ccce31580069279df3fa835aa038d73