fix: characters escaping (#4472)

master
Evilebot Tnawi 2018-05-14 13:47:46 +03:00 committed by GitHub
parent dc68a3d9a6
commit 6cd6ea383e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 221 additions and 3 deletions

View File

@ -410,9 +410,6 @@ function genericPrint(path, options, print) {
const iNextNode = node.groups[i + 1];
const iNextNextNode = node.groups[i + 2];
if (isPostcssSimpleVar(iNode, iNextNode)) {
continue;
}
// Ignore after latest node (i.e. before semicolon)
if (!iNextNode) {
continue;
@ -433,6 +430,16 @@ function genericPrint(path, options, print) {
continue;
}
// Ignore `\` (i.e. `$variable: \@small;`)
if (iNode.value === "\\") {
continue;
}
// Ignore `$$` (i.e. `background-color: $$(style)Color;`)
if (isPostcssSimpleVar(iNode, iNextNode)) {
continue;
}
if (
(iPrevNode &&
iPrevNode.type === "value-comment" &&

View File

@ -0,0 +1,142 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`character_escaping.css 1`] = `
#♥ {}
#© {}
#“‘’” {}
#☺☃ {}
#⌘⌥ {}
#𝄞♪♩♫♬ {}
#💩 {}
#\\? {}
#\\@ {}
#\\. {}
#\\3A \\) {}
#\\3A \\\`\\( {}
#\\31 23 {}
#\\31 a2b3c {}
#\\<p\\> {}
#\\<\\>\\<\\<\\<\\>\\>\\<\\> {}
#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\. {}
#\\# {}
#\\#\\# {}
#\\#\\.\\#\\.\\# {}
#\\#fake-id {} /* matches the element with id="#fake-id" */
#\\_ {}
#\\{\\} {}
#\\.fake\\-class {}
#foo\\.bar {}
#\\3A hover {}
#\\3A hover\\3A focus\\3A active {}
#\\[attr\\=value\\] {}
#f\\/o\\/o {}
#f\\\\o\\\\o {}
#f\\*o\\*o {}
#f\\!o\\!o {}
#f\\'o\\'o {}
#f\\~o\\~o {}
#f\\+o\\+o {}
#-a-b-c- {}
#a\\\\b {}
@keyframes \\@mymove {
from {top: 0px;}
to {top: 200px;}
}
.foo {
animation-name: \\@mymove;
content: "\\21D3";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#♥ {
}
#© {
}
#“‘’” {
}
#☺☃ {
}
#⌘⌥ {
}
#𝄞♪♩♫♬ {
}
#💩 {
}
#\\? {
}
#\\@ {
}
#\\. {
}
#\\3A \\) {
}
#\\3A \\\`\\( {
}
#\\31 23 {
}
#\\31 a2b3c {
}
#\\<p\\> {
}
#\\<\\>\\<\\<\\<\\>\\>\\<\\> {
}
#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\. {
}
#\\# {
}
#\\#\\# {
}
#\\#\\.\\#\\.\\# {
}
#\\#fake-id {
} /* matches the element with id="#fake-id" */
#\\_ {
}
#\\{\\} {
}
#\\.fake\\-class {
}
#foo\\.bar {
}
#\\3A hover {
}
#\\3A hover\\3a focus\\3a active {
}
#\\[attr\\=value\\] {
}
#f\\/o\\/o {
}
#f\\\\o\\\\o {
}
#f\\*o\\*o {
}
#f\\!o\\!o {
}
#f\\'o\\'o {
}
#f\\~o\\~o {
}
#f\\+o\\+o {
}
#-a-b-c- {
}
#a\\\\b {
}
@keyframes \\@mymove {
from {
top: 0px;
}
to {
top: 200px;
}
}
.foo {
animation-name: \\@mymove;
content: "\\21D3";
}
`;

View File

@ -0,0 +1,48 @@
# {}
#© {}
# {}
# {}
# {}
#𝄞 {}
#💩 {}
#\? {}
#\@ {}
#\. {}
#\3A \) {}
#\3A \`\( {}
#\31 23 {}
#\31 a2b3c {}
#\<p\> {}
#\<\>\<\<\<\>\>\<\> {}
#\+\+\+\+\+\+\+\+\+\+\[\>\+\+\+\+\+\+\+\>\+\+\+\+\+\+\+\+\+\+\>\+\+\+\>\+\<\<\<\<\-\]\>\+\+\.\>\+\.\+\+\+\+\+\+\+\.\.\+\+\+\.\>\+\+\.\<\<\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\.\>\.\+\+\+\.\-\-\-\-\-\-\.\-\-\-\-\-\-\-\-\.\>\+\.\>\. {}
#\# {}
#\#\# {}
#\#\.\#\.\# {}
#\#fake-id {} /* matches the element with id="#fake-id" */
#\_ {}
#\{\} {}
#\.fake\-class {}
#foo\.bar {}
#\3A hover {}
#\3A hover\3A focus\3A active {}
#\[attr\=value\] {}
#f\/o\/o {}
#f\\o\\o {}
#f\*o\*o {}
#f\!o\!o {}
#f\'o\'o {}
#f\~o\~o {}
#f\+o\+o {}
#-a-b-c- {}
#a\\b {}
@keyframes \@mymove {
from {top: 0px;}
to {top: 200px;}
}
.foo {
animation-name: \@mymove;
content: "\21D3";
}

View File

@ -0,0 +1 @@
run_spec(__dirname, ["css"]);

View File

@ -884,6 +884,13 @@ light: #eaf0c6
@function color($color, $tone: "base") {
@return map-get(map-get($colors, $color), $tone);
}
@media only screen and (max-width: 767px) {
@include widths(2 3 4, \\@small);
}
$widths-breakpoint-separator: \\@small;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@media #{$g-breakpoint-tiny} {
}
@ -1568,4 +1575,10 @@ $colors: (
@return map-get(map-get($colors, $color), $tone);
}
@media only screen and (max-width: 767px) {
@include widths(2 3 4, \\@small);
}
$widths-breakpoint-separator: \\@small;
`;

View File

@ -874,3 +874,10 @@ light: #eaf0c6
@function color($color, $tone: "base") {
@return map-get(map-get($colors, $color), $tone);
}
@media only screen and (max-width: 767px) {
@include widths(2 3 4, \@small);
}
$widths-breakpoint-separator: \@small;