mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
Merge 34d95f2978 into a273bc99d2
This commit is contained in:
commit
601a7f9e9a
1 changed files with 12 additions and 1 deletions
|
|
@ -141,7 +141,8 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
|
|||
argument is a list of ``(name, value)`` pairs containing the attributes found
|
||||
inside the tag's ``<>`` brackets. The *name* will be translated to lower case,
|
||||
and quotes in the *value* have been removed, and character and entity references
|
||||
have been replaced.
|
||||
have been replaced. If a boolean attribute is encountered, the *value* for the
|
||||
``(name, value)`` attribute pair will be ``None``.
|
||||
|
||||
For instance, for the tag ``<A HREF="https://www.cwi.nl/">``, this method
|
||||
would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])``.
|
||||
|
|
@ -317,6 +318,16 @@ without further parsing:
|
|||
Data : alert("<strong>hello! ☺</strong>");
|
||||
End tag : script
|
||||
|
||||
Boolean attributes have a *value* of ``None``:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> parser.feed("<script src='/script.js' defer></script>")
|
||||
Start tag: script
|
||||
attr: ('src', '/script.js')
|
||||
attr: ('defer', None)
|
||||
End tag : script
|
||||
|
||||
Parsing comments:
|
||||
|
||||
.. doctest::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue