Skip to content

Commit 10e54c1

Browse files
authored
Merge pull request #327 from jvanasco/fix_updated_constants
added `itemscope` as a boolean attribute (issue #194)
2 parents 8788bda + 792fbdb commit 10e54c1

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

AUTHORS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ Patches and suggestions
4242
- Michael[tm] Smith
4343
- Marc Abramowitz
4444
- Jon Dufresne
45+
- Jonathan Vanasco

CHANGES.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Change Log
22
----------
33

4+
unreleased
5+
~~~~~~~~~~~~~~~~~~
6+
7+
* Added `itemscope` as boolean attribute
8+
https://github.com/html5lib/html5lib-python/issues/194
9+
410
0.999999999/1.0b10
511
~~~~~~~~~~~~~~~~~~
612

html5lib/constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@
588588
])
589589

590590
booleanAttributes = {
591-
"": frozenset(["irrelevant"]),
591+
"": frozenset(["irrelevant", "itemscope"]),
592592
"style": frozenset(["scoped"]),
593593
"img": frozenset(["ismap"]),
594594
"audio": frozenset(["autoplay", "controls"]),

html5lib/tests/serializer-testdata/options.test

+69
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,29 @@
4646
"quote_attr_values": "always"
4747
}
4848
},
49+
{
50+
"expected": [
51+
"<div itemscope>"
52+
],
53+
"input": [
54+
[
55+
"StartTag",
56+
"http://www.w3.org/1999/xhtml",
57+
"div",
58+
[
59+
{
60+
"namespace": null,
61+
"name": "itemscope",
62+
"value": "itemscope"
63+
}
64+
]
65+
]
66+
],
67+
"description": "quote_attr_values='always' with itemscope",
68+
"options": {
69+
"quote_attr_values": "always"
70+
}
71+
},
4972
{
5073
"expected": [
5174
"<div irrelevant>"
@@ -171,6 +194,29 @@
171194
"use_trailing_solidus": true
172195
}
173196
},
197+
{
198+
"expected": [
199+
"<div itemscope=itemscope>"
200+
],
201+
"input": [
202+
[
203+
"StartTag",
204+
"http://www.w3.org/1999/xhtml",
205+
"div",
206+
[
207+
{
208+
"namespace": null,
209+
"name": "itemscope",
210+
"value": "itemscope"
211+
}
212+
]
213+
]
214+
],
215+
"description": "minimize_boolean_attributes=false",
216+
"options": {
217+
"minimize_boolean_attributes": false
218+
}
219+
},
174220
{
175221
"expected": [
176222
"<div irrelevant=irrelevant>"
@@ -194,6 +240,29 @@
194240
"minimize_boolean_attributes": false
195241
}
196242
},
243+
{
244+
"expected": [
245+
"<div itemscope=\"\">"
246+
],
247+
"input": [
248+
[
249+
"StartTag",
250+
"http://www.w3.org/1999/xhtml",
251+
"div",
252+
[
253+
{
254+
"namespace": null,
255+
"name": "itemscope",
256+
"value": ""
257+
}
258+
]
259+
]
260+
],
261+
"description": "minimize_boolean_attributes=false with empty value",
262+
"options": {
263+
"minimize_boolean_attributes": false
264+
}
265+
},
197266
{
198267
"expected": [
199268
"<div irrelevant=\"\">"

0 commit comments

Comments
 (0)