(Bug 50330) Finished incomplete fix to HTML5 lib from 3207ae0f

* Git commit 3207ae0f made fixes to the HTML5 library to foster parent
  link, base, style, script tags out of tables.

* However, because of not reading code carefully, I didn't close
  the fostered elements by popping them from the list of open
  elements. This led to a situation where multiple fostered elements
  got nested in each other (Ex: links tags nested in each other)
  which results in an buggy DOM.

* This patch fixes the problem with encapsulating the templates in
  en:Queen's Blade and lets it RT correctly.

* Fixes parse output for snippet:

  <table>[[Category:foo1]][[Category:foo2]]<tr><td>foo</td></tr></table>

  Before this patch, [[Category:foo2]] would be lost in the parse
  output. With this patch, this problem is fixed.  This won't RT
  correctly because of the fostering.

* New parser test added to track this scenario
  - wt2html passes.
  - wt2wt fails and has been added to the blacklist.
  - Without data-parsoid, html2wt and html2html tests wont pass.

Change-Id: I67ae54e7bb2d8e74ca42248eb37edc7b101369b0
Merge "(Bug 50330) Finished incomplete fix to HTML5 lib from 3207ae0f"