Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

Refs #17758
  • Loading branch information...
commit 8bc410b44536e03ee38a0087256faf367dd98dd9 1 parent 1ae64e9
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 8bc410b

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