mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
HTMLParser is now able to handle slashes in the start tag.
This commit is contained in:
parent
178e5ea305
commit
29877e8e04
3 changed files with 34 additions and 7 deletions
|
@ -389,6 +389,27 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
|
|||
self._run_check("<a foo='>'", [('data', "<a foo='>'")])
|
||||
self._run_check("<a foo='>", [('data', "<a foo='>")])
|
||||
|
||||
def test_slashes_in_starttag(self):
|
||||
self._run_check('<a foo="var"/>', [('startendtag', 'a', [('foo', 'var')])])
|
||||
html = ('<img width=902 height=250px '
|
||||
'src="/sites/default/files/images/homepage/foo.jpg" '
|
||||
'/*what am I doing here*/ />')
|
||||
expected = [(
|
||||
'startendtag', 'img',
|
||||
[('width', '902'), ('height', '250px'),
|
||||
('src', '/sites/default/files/images/homepage/foo.jpg'),
|
||||
('*what', None), ('am', None), ('i', None),
|
||||
('doing', None), ('here*', None)]
|
||||
)]
|
||||
self._run_check(html, expected)
|
||||
html = ('<a / /foo/ / /=/ / /bar/ / />'
|
||||
'<a / /foo/ / /=/ / /bar/ / >')
|
||||
expected = [
|
||||
('startendtag', 'a', [('foo', None), ('=', None), ('bar', None)]),
|
||||
('starttag', 'a', [('foo', None), ('=', None), ('bar', None)])
|
||||
]
|
||||
self._run_check(html, expected)
|
||||
|
||||
def test_declaration_junk_chars(self):
|
||||
self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue