Skip to content

Commit fbbea1f

Browse files
committed
Update lint filter for namespaced attributes
1 parent 40c3ba6 commit fbbea1f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

html5lib/filters/lint.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ def __iter__(self):
3333
raise LintError("Non-void element reported as EmptyTag token: %(tag)s" % {"tag": token["name"]})
3434
if type == "StartTag":
3535
open_elements.append(name)
36-
for name, value in token["data"]:
37-
if not isinstance(name, text_type):
38-
raise LintError("Attribute name is not a string: %(name)r" % {"name": name})
39-
if not name:
40-
raise LintError("Empty attribute name")
36+
for (namespace, localname), value in token["data"].items():
37+
if namespace is not None and not isinstance(namespace, text_type):
38+
raise LintError("Attribute namespace is not a string or None: %(name)r" % {"name": namespace})
39+
if namespace == "":
40+
raise LintError("Empty attribute namespace")
41+
if not isinstance(localname, text_type):
42+
raise LintError("Attribute localname is not a string: %(name)r" % {"name": localname})
43+
if not localname:
44+
raise LintError("Empty attribute localname")
4145
if not isinstance(value, text_type):
4246
raise LintError("Attribute value is not a string: %(value)r" % {"value": value})
4347
if name in cdataElements:

0 commit comments

Comments
 (0)