Opened 6 years ago
Closed 6 years ago
#30468 closed Bug (fixed)
assertHTMLEqual doesn't account for all ASCII whitespace in a class attribute.
Reported by: | Jon Dufresne | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
# 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 ]
Change History (4)
comment:1 by , 6 years ago
Has patch: | set |
---|
comment:3 by , 6 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
PR