Merge pull request #9761 from lodr/bug-828298-fixing-mindgap

Bug 828298 - Fixig a problem in the algorithm closing a tag in mindgap.js
r=leo.bugzilla.gaia@gmail.com(cherry picked from commit e29317b6599f4ac51e1d86366287fcc13fd4467d)