Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute selectors should compare names according to spec #3322

Closed
Ms2ger opened this issue Sep 13, 2014 · 1 comment
Closed

Attribute selectors should compare names according to spec #3322

Ms2ger opened this issue Sep 13, 2014 · 1 comment

Comments

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Sep 13, 2014

The HTML spec states

When comparing the name part of a CSS attribute selector to the names of namespace-less attributes on HTML elements in HTML documents, the name part of the CSS attribute selector must first be converted to ASCII lowercase. The same selector when compared to other attributes must be compared according to its original case. In both cases, the comparison is case-sensitive.

In particular, in a HTML document, [FOO] should

  • match an HTML element with a namespace-less foo attribute
  • not match an HTML element with a namespace-less FOO attribute
  • not match a non-HTML element with a namespace-less foo attribute
  • match a non-HTML element with a namespace-less FOO attribute
  • not match an HTML element with a namespaced foo attribute
  • match an HTML element with a namespaced FOO attribute
  • not match a non-HTML element with a namespaced foo attribute
  • match a non-HTML element with a namespaced FOO attribute
    (and we'll want tests for all those).

cc @SimonSapin

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Sep 16, 2014

I believe we’re doing this right already. [FOO] is equivalent to [|FOO], and so should not match any namespaced attribute.

For test cases: the HTML parser normalizes attribute names to ASCII lower case, so a FOO attribute can only be created through DOM manipulation.

bors-servo added a commit that referenced this issue May 18, 2017
Shrink selectors::Component, implement attr selector (in)case-sensitivity

* https://bugzilla.mozilla.org/show_bug.cgi?id=1364148
* https://bugzilla.mozilla.org/show_bug.cgi?id=1364162
* https://bugzilla.mozilla.org/show_bug.cgi?id=1363531
* Fixes #3322

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16915)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.