(Bug 51217) Detect fostered content and ignore in selser

* Added a dom pass to detect fostered nodes (and text in some
  scenarios -- see comments in code for more info about this)

* Removed older fostered content tests and reused new flag.

* 8 selser tests failing (because wt2wt is at fault, not selser.
  See Bug 51718 for this -- we really need to fix this some way
  sooner than later) and blacklisted for now.

* Manually tested with this snippet by making changes to
  para-1 and para-2 and ensuring that selser doesn't duplicate
  'will be fostered' outside the table
------------
para-1
{|
will be fostered
|-
|bar
|}
para-2
------------

* Unrelated changes: some comment cleanup and reordering.

* Tested with the following pages which were used to test early
  handling of fostered content from templates and verified that
  nothing is broken.

  - en:Almirante_Latorre-class_battleship
  - en:HMS_Salisbury_(F32)

Change-Id: I36f2746509791059d8dcbf88f59f4bc7d57582b0