This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chenyun Yang
Recipients Chenyun Yang, ezio.melotti, josh.r, martin.panter, r.david.murray, xiang.zhang
Date 2015-10-03.19:43:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAJZGQB4-veHLs1cKXnr-sL-0CwzZGaPY3YRUS8+NFUyjsfU6=Q@mail.gmail.com>
In-reply-to <1443883667.05.0.503790260445.issue25258@psf.upfronthosting.co.za>
Content
handle_startendtag is also called for non-void elements, such as <a/>, so
the override example will break in those situation.

The compatible patch I proposed right now is just one liner checker:

# http://www.w3.org/TR/html5/syntax.html#void-elements
<https://www.google.com/url?q=http://www.w3.org/TR/html5/syntax.html%23void-elements&usg=AFQjCNFVtfyZ53NDOHlPq896qmX5b8fPTA>_VOID_ELEMENT_TAGS
= frozenset([    'area', 'base', 'br', 'col', 'embed', 'hr', 'img',
'input', 'keygen',    'link', 'meta', 'param', 'source', 'track',
'wbr'])class HTMLParser.HTMLParser:  # Internal -- handle starttag,
return end or -1 if not terminated  def parse_starttag(self, i):
#...    if end.endswith('/>'):      # XHTML-style empty tag: <span
attr="value" />      self.handle_startendtag(tag, attrs)
#############    PATCH    #################    elif end.endswith('>')
and tag in _VOID_ELEMENT_TAGS:      self.handle_startendtag(tag,
attrs)    #############    PATCH    #################
History
Date User Action Args
2015-10-03 19:43:29Chenyun Yangsetrecipients: + Chenyun Yang, ezio.melotti, r.david.murray, martin.panter, josh.r, xiang.zhang
2015-10-03 19:43:29Chenyun Yanglinkissue25258 messages
2015-10-03 19:43:28Chenyun Yangcreate