Kaydet (Commit) 8bc410b4 authored tarafından Luke Plant's avatar Luke Plant

Fixed HTML comparisons of class="foo bar" and class="bar foo" in tests

Refs #17758
üst 1ae64e96
......@@ -182,6 +182,14 @@ class Parser(HTMLParser):
self.handle_endtag(tag)
def handle_starttag(self, tag, attrs):
# Special case handling of 'class' attribute, so that comparisons of DOM
# instances are not sensitive to ordering of classes.
attrs = [
(name, " ".join(sorted(value.split(" "))))
if name == "class"
else (name, value)
for name, value in attrs
]
element = Element(tag, attrs)
self.current.append(element)
if tag not in self.SELF_CLOSING_TAGS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment