mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
[1.5.x] Fixed HTML comparisons of class="foo bar" and class="bar foo" in tests
Refs #17758 Backport of 8bc410b44536e03ee38a0087256faf367dd98dd9 from master
This commit is contained in:
parent
00aea69f06
commit
2164cd00ec
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user