Hey,
I've just found an issue with the Text Filter 'Correct faulty and chopped off HTML' on D8
It seems to incorrectly close the tag.
For example:
<video>
<source src="..." type="video/mp4">
</video>
Would output the following the the filter on:
<video>
<source src="..." type="video/mp4"></source>
</video>
This is the case even if I was to self close, which is actually invalid html.
The correct result would be to not act on <source>.
I'm not sure if this filter actually removes incorrect html closing tags?
Thanks,
Oliver.
Comments
Comment #2
ocastle commentedComment #3
eporama commentedI think this is due to how we process the filtereed text in
FilterHtmlCorrector::process(), we callHtml::normalize($text)which loads the text snippet as the body of a new HTML document and then builds aDOMDocumentelement on that and calls thesaveXML()method to write out valid XML for each snippet.However, in
HTML::load()we build up the new HTML document as an XHTML doc:However,
sourceisn't a valid XHTML element, so it just punts it to having a close element. I don't know what the full ramifications would be to change that XHTML document template to a valid HTML template, but in a quick test,Produced the following:
Comment #4
eporama commentedLooks like this may be being discussed already in #1333730: [Meta] PHP DOM (libxml2) misinterprets HTML5 and a much more extensive solution is being handled in #2441811: Upgrade filter system to HTML5 which includes this quick test that I just had, so I would say this is probably a duplicate and can be closed.
Comment #5
ocastle commentedAgreed, #1333730 covers the issue.
Closing as duplicate