Filter HTML into XML upon loading document
Closed this issue · 2 comments
Deleted user commented
Let's say we've got the following code:
<script><!--
var poop = [red, green, brown];
for (var i = poop.length - 1; i >= 0; i--) {
console.log(poop[i]);
}
--></script>
Upon reaching i--
, the DOM parser will think it's reached the end of the comment block; however, >
is missing, and you'll see this warning:
Warning: DOMDocument::loadXML(): Comment not terminated
...and a blank page.
/* <![CDATA[ */
. . . /* ]]> */
will work, but it would be nice if we could avoid this sort of 'hack' altogether.
Kroc commented
Yup, this is just weak input validation. I shall make DOMTemplate add CDATA markers automatically so as to fix this, and other, issues.
Kroc commented
Renamed issue to a more general "filter HTML into XML upon loading document". Whilst script fixing is important, there'll likely be other munges that will need to be made.