Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.x] Fixed HTML comparisons of class="foo bar" and class="bar foo"…

… in tests

Refs #17758

Backport of 8bc410b from master
  • Loading branch information...
commit 2164cd00ecdb61774d05f5f278078a28c926779f 1 parent 00aea69
Luke Plant authored December 24, 2012

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. 8  django/test/html.py
8  django/test/html.py
@@ -182,6 +182,14 @@ def handle_startendtag(self, tag, attrs):
182 182
             self.handle_endtag(tag)
183 183
 
184 184
     def handle_starttag(self, tag, attrs):
  185
+        # Special case handling of 'class' attribute, so that comparisons of DOM
  186
+        # instances are not sensitive to ordering of classes.
  187
+        attrs = [
  188
+            (name, " ".join(sorted(value.split(" "))))
  189
+            if name == "class"
  190
+            else (name, value)
  191
+            for name, value in attrs
  192
+            ]
185 193
         element = Element(tag, attrs)
186 194
         self.current.append(element)
187 195
         if tag not in self.SELF_CLOSING_TAGS:

0 notes on commit 2164cd0

Please sign in to comment.
Something went wrong with that request. Please try again.