<br><br><div class="gmail_quote">On Thu, Jul 28, 2011 at 11:25, Matt <span dir="ltr">&lt;<a href="mailto:mattbasta@gmail.com">mattbasta@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hello all,<br>
<br>
I wanted to ask a few questions and start a discussion about HTML5<br>
support within the HTMLParser class(es). Over on issue 670664, an<br>
inconsistency with the way browsers and the HTMLParser parse script<br>
and style tags was discovered. Currently, HTMLParser adheres strictly<br>
to the HTML4 standard, which says that these tags should exit CDATA<br>
mode when the start of *any* closing tag is found. No browsers, to my<br>
knowledge, have ever supported this (at least in the 21st century).<br>
Instead, all browsers implement the behavior described in the HTML5<br>
spec, which states that script tags should exit their &quot;raw text mode&quot;<br>
when the full closing tag for that element is encountered.<br>
<br>
The repercussions of adhering to the HTML4 standard in HTMLParser are<br>
somewhat serious: a good number of documents will either encounter<br>
exceptions for broken markup (which aren&#39;t actually broken). Libraries<br>
like Beautiful Soup (which depend on HTMLParser) are also affected,<br>
requiring the use of hacks just to get the document to parse at all.<br>
<br>
Rather than bore you all with another paragraph about how HTML4 is<br>
terrible, feel free to look at the issue<br>
(<a href="http://bugs.python.org/issue670664" target="_blank">http://bugs.python.org/issue670664</a>), which quite thoroughly outlines<br>
the pros and cons of this particular change. Any feedback/input  on<br>
the proposed changes is welcome.<br>
<br>
So here are my questions:<br>
<br>
- What plans, if any, are there to support HTML5 parsing behaviors,<br>
since the HTML5 spec effectively describes current web browser<br>
behavior?<br></blockquote><div><br>There are not specific plans that have been publicly brought up (to my knowledge).<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


- What policies are in place for keeping parity with other HTML<br>
parsers (such as those in web browsers)?<br></blockquote><div><br>There aren&#39;t any beyond &quot;it would be nice&quot;.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
Given the semi-backward-compatible nature of HTML5&#39;s syntax, this<br>
seems like a rather unique problem that could use some more<br>
discussion.<br></blockquote><div><br>It&#39;s more of an issue of someone caring enough to do the coding work to  bring the parser up to spec for HTML5 (or introduce new code to live beside the HTML4 parsing code). IOW there is no policies specifically about this topic beyond the general desire to stay up-to-date with stable specs.<br>

</div></div>