8000 r2129 of spec: <optgroup> implies </option> · labrys/html5lib-python@9f4b251 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f4b251

Browse files
committed
r2129 of spec: <optgroup> implies </option>
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401215
1 parent 54bb5ec commit 9f4b251

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/html5lib/filters/optionaltags.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,13 @@ def is_optional_end(self, tagname, next):
8181
# An html element's end tag may be omitted if the html element
8282
# is not immediately followed by a space character or a comment.
8383
return type not in ("Comment", "SpaceCharacters")
84-
elif tagname in ('li', 'optgroup', 'option', 'tr'):
84+
elif tagname in ('li', 'optgroup', 'tr'):
8585
# A li element's end tag may be omitted if the li element is
8686
# immediately followed by another li element or if there is
8787
# no more content in the parent element.
8888
# An optgroup element's end tag may be omitted if the optgroup
8989
# element is immediately followed by another optgroup element,
9090
# or if there is no more content in the parent element.
91-
# An option element's end tag may be omitted if the option
92-
# element is immediately followed by another option element,
93-
# or if there is no more content in the parent element.
9491
# A tr element's end tag may be omitted if the tr element is
9592
# immediately followed by another tr element, or if there is
9693
# no more content in the parent element.
@@ -125,6 +122,16 @@ def is_optional_end(self, tagname, next):
125122
'p', 'pre', 'section', 'table', 'ul')
126123
else:
127124
return type == "EndTag" or type is None
125+
elif tagname == 'option':
126+
# An option element's end tag may be omitted if the option
127+
# element is immediately followed by another option element,
128+
# or if it is immediately followed by an <code>optgroup</code>
129+
# element, or if there is no more content in the parent
130+
# element.
131+
if type == "StartTag":
132+
return next["name"] in ('option', 'optgroup')
133+
else:
134+
return type == "EndTag" or type is None
128135
elif tagname in ('rt', 'rp'):
129136
# An rt element's end tag may be omitted if the rt element is
130137
# immediately followed by an rt or rp element, or if there is

0 commit comments

Comments
 (0)
0