Item14393: prevent any output after the closing html element
Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release:
Applies To: Extension
Component: NatSkin
Branches:
NatSkin offers the
PageOptimizerPlugin as an optional dependency. However if this is not installed, NatSkin will spam the output page with comments and generated tags
after the closing </html>. The HTML it generates is invalid, which can cause other processes which parse the HTML to fail mysteriously (such as
SafeWikiPlugin and validators). It also crashes hard when run with DEBUG on, something that really took me by surprise.
You could:
- Restructure the templates to generate those comments within the </html>
- Make PageOptimizerPlugin a required dependency
--
CrawfordCurrie - 08 May 2017
... or let the core remove any cruft behind a closing </html>.
What kind of crash report do you get when enabling DEBUG?
--
MichaelDaum - 08 May 2017
An ASSERT failure (L803 in Foswiki.pm)
I really don't think the core should be making judgements about what the template generation produces. I only added that ASSERT after we had issues with templates producing content after the HTML, way back in Thiki days, when it was causing mysterious crashes in browsers. The idea of editing the HTML... no, that's way outside the envelope for the core. We need to be removing HTML knowledge, not adding more.
--
Main.CrawfordCurrie - 08 May 2017 - 17:52
Hm...
--
MichaelDaum - 09 May 2017
Further, you don't
need all those HTML comments in the templates.
Templates.pm
has a TRACE mode that generates a trace of the templates. You could convert all those <!-- comments to %{ comments for no loss of traceability.
--
Main.CrawfordCurrie - 09 May 2017 - 08:56
They are mostly there to prevent sporadic new-lines resulting in
<p>
elements where they don't belong. I will kick out those other
<-- template: ...>
comments completely.
--
MichaelDaum - 09 May 2017
You can use %{}% that way too. I know
NatSkin predates those comments, and what you did makes sense in most places; it just needs a bit of an update
--
CrawfordCurrie - 09 May 2017