Fixes issues thrown in custom HMTL head & page content filtering when the content is comprised of only a single HTML comment. Adds tests to cover. For #2804
Since it appeared to cause problems in some scenarios. Related to #2490