You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #62 I encountered problems related to the AMP library's support for HTML5. The main issue is that we're using the inbuilt HTML parser of PHP DOM (libxml version is 2.9.0).
The following does not parse properly for instance:
<audiocontrolsautoplay><p>Your browser does not support the <strong>audio</strong> tag</p><sourcesrc="abc.wav" type="audio/wav"><sourcesrc="xyz.mp3" type="audio/mpeg"></audio>
(The above HTML actually parses without any fatal errors but the parse tree is not correct).
This HTML needs to be changed to:
<audiocontrolsautoplay><p>Your browser does not support the <strong>audio</strong> tag</p><sourcesrc="abc.wav" type="audio/wav" />
<sourcesrc="xyz.mp3" type="audio/mpeg" />
</audio>
Notice that <source> was changed to <source /> so that the PHP dom parser knows that the tag has ended.
We can't expect users to do this while entering HTML. Users should be able to provide valid HTML5 in additional to traditional HTML.
The solution is to not use the default parser but the mastermind/html5-php library to parse the HTML5 to build the DOMDocument. (We're already using this library for HTML output)
The use of mastermind for input is a seemingly small change but causes a huge problem: We cannot point out line numbers when we find validation issues. DOMNode::getLineNo() always returns zero.
I filed an issue on the mastermind/html5-php. Sadly there has been no response on it (yet).
I have been able to make my own workaround though (See filed issue for workaround details).
Task for this ticket:
Make the changes in the AMP Library to use the mastermind/html5-php library for input HTML parsing. Add workaround for line numbers.
The text was updated successfully, but these errors were encountered:
While working on #62 I encountered problems related to the AMP library's support for HTML5. The main issue is that we're using the inbuilt HTML parser of PHP DOM (libxml version is 2.9.0).
The following does not parse properly for instance:
(The above HTML actually parses without any fatal errors but the parse tree is not correct).
This HTML needs to be changed to:
Notice that
<source>
was changed to<source />
so that the PHP dom parser knows that the tag has ended.We can't expect users to do this while entering HTML. Users should be able to provide valid HTML5 in additional to traditional HTML.
The solution is to not use the default parser but the
mastermind/html5-php
library to parse the HTML5 to build theDOMDocument
. (We're already using this library for HTML output)The use of mastermind for input is a seemingly small change but causes a huge problem: We cannot point out line numbers when we find validation issues.
DOMNode::getLineNo()
always returns zero.I filed an issue on the
mastermind/html5-php
. Sadly there has been no response on it (yet).I have been able to make my own workaround though (See filed issue for workaround details).
Task for this ticket:
The text was updated successfully, but these errors were encountered: