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

Don't lowercase element names and attribute names in selectors #3317

Merged
merged 2 commits into from Nov 27, 2017

Conversation

Projects
None yet
3 participants
@lydell
Collaborator

lydell commented Nov 25, 2017

https://www.w3.org/TR/css3-selectors/#casesens

All Selectors syntax is case-insensitive within the ASCII range (i.e.
[a-z] and [A-Z] are equivalent), except for parts that are not under the
control of Selectors. The case sensitivity of document language element
names, attribute names, and attribute values in selectors depends on the
document language. For example, in HTML, element names are
case-insensitive, but in XML, they are case-sensitive.

Fixes #3304.

@lydell lydell force-pushed the lydell:css-case-fix branch from 9fb1a3d to b1d3a01 Nov 25, 2017

.Keep (@Keep) WHEN (lightness(@Keep) >= Keep12PX) AND (@Keep > @Keep12E5) {}
.Keep (@Keep) when (lightness(@Keep) >= 12PX) and (@Keep > 0) {}
.Keep (@Keep) when (lightness(@Keep) != '12PX') and (@Keep != "12PX") {}
.Keep (@Keep) when (lightness(@Keep) >= Keep12PX) and (@Keep > @Keep12E5) {}

This comment has been minimized.

@lydell

lydell Nov 25, 2017

Collaborator

As far as I understand, Less only accepts when and and lowercase.

@@ -292,17 +300,17 @@ a[href="KeepAttrValue"]:hover::first-letter,
}
@keyframes KeepAnimationName {
from {
FROM {

This comment has been minimized.

@lydell

lydell Nov 25, 2017

Collaborator

from and to could technically be lowercased in @keyframes, but I don’t think it is worth the trouble.

@azz

azz approved these changes Nov 25, 2017

@@ -89,15 +91,17 @@ $KeepScssVar: val;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Convention in this test file:
// - The case should be preserved for things prefixed with "Keep".
// - The case should always be preserved for function names and property keywords.
// - The case should always be preserved for element names and attribute names
// in selectors, as well as function names and property keywords.
// - Other things should mostly be lowercase.
// - The \`/*:*/\` comments are just to bust the \`isLikelySCSS\` check.

This comment has been minimized.

@azz

azz Nov 25, 2017

Member

Unrelated to this PR, but can we use parser: "less" instead of the comments now?

This comment has been minimized.

@lydell

lydell Nov 25, 2017

Collaborator

I don’t know.

@lydell lydell force-pushed the lydell:css-case-fix branch from b1d3a01 to ee10622 Nov 25, 2017

Don't lowercase element names and attribute names in selectors
https://www.w3.org/TR/css3-selectors/#casesens

> All Selectors syntax is case-insensitive within the ASCII range (i.e.
> [a-z] and [A-Z] are equivalent), except for parts that are not under the
> control of Selectors. The case sensitivity of document language element
> names, attribute names, and attribute values in selectors depends on the
> document language. For example, in HTML, element names are
> case-insensitive, but in XML, they are case-sensitive.

Fixes #3304.

@lydell lydell force-pushed the lydell:css-case-fix branch from ee10622 to 941b8f8 Nov 25, 2017

prop: val;
}
#{$KeepInterpolationVar},
#{$Keep + 15px},
#{$Keep + 15PX},

This comment has been minimized.

@lydell

lydell Nov 25, 2017

Collaborator

Oops, I didn't see this one when looking through the diff before. Need to lowercase that "PX".

@azz

This comment has been minimized.

Member

azz commented Nov 27, 2017

Good to merge?

@lydell lydell merged commit 56951a7 into prettier:master Nov 27, 2017

3 checks passed

codecov/patch 100% of diff hit (target 80%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +2.93% compared to b941e30
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@lydell lydell deleted the lydell:css-case-fix branch Nov 27, 2017

@suchipi suchipi added this to the 1.9 milestone Nov 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment