@@ -134,8 +134,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
134134 argument is a list of ``(name, value) `` pairs containing the attributes found
135135 inside the tag's ``<> `` brackets. The *name * will be translated to lower case,
136136 and quotes in the *value * have been removed, and character and entity references
137- have been replaced. If a boolean attribute is encountered, the *value * for the
138- ``(name, value) `` attribute pair will be ``None ``.
137+ have been replaced. For empty attributes, *value * is ``None ``.
139138
140139 For instance, for the tag ``<A HREF="https://www.cwi.nl/"> ``, this method
141140 would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')]) ``.
@@ -311,15 +310,17 @@ further parsing:
311310 Data : alert("<strong>hello!</strong>");
312311 End tag : script
313312
314- Boolean attributes have a *value * of ``None ``:
313+ Attribute names are converted to lowercase, quotes from attribute values removed,
314+ and ``None `` is returned as *value * for empty attributes (such as `checked `):
315315
316316.. doctest ::
317317
318- >>> parser.feed(" <script src='/script.js' defer></script>" )
319- Start tag: script
320- attr: ('src', '/script.js')
321- attr: ('defer', None)
322- End tag : script
318+ >>> parser.feed(" <input TYPE='checkbox' checked required='' disabled=disabled>" )
319+ Start tag: input
320+ attr: ('type', 'checkbox')
321+ attr: ('checked', None)
322+ attr: ('required', '')
323+ attr: ('disabled', 'disabled')
323324
324325Parsing comments:
325326
0 commit comments