#30468: assertHTMLEqual doesn't account for all ASCII whitespace in a class
attribute.
---------------------------------------------+------------------------
               Reporter:  Jon Dufresne       |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  master
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 From https://html.spec.whatwg.org/#classes

 > When specified on HTML elements, the class attribute must have a value
 that is a set of space-separated tokens representing the various classes
 that the element belongs to.

 And "space-separated tokens" is defined as:

 https://html.spec.whatwg.org/#set-of-space-separated-tokens

 > A set of space-separated tokens is a string containing zero or more
 words (known as tokens) separated by one or more ASCII whitespace, where
 words consist of any string of one or more characters, none of which are
 ASCII whitespace.

 And "ASCII whitespace" is defined as:

 https://infra.spec.whatwg.org/#ascii-whitespace

 > ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or
 U+0020 SPACE.

 The current implementation (copied and linked below) only accounts for a
 single space. Not all consecutive ASCII whitespace.


 
https://github.com/django/django/blob/48235ba807483fe349d2dc66aaeddc0d03f8b0d4/django/test/html.py#L180-L187

 {{{
         # 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
         ]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30468>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.c5ae7c112bdad78ad455da3f45f78d0b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to