Trim whitespace in descendant combinator, fixes #2410 (#2411)

* Trim whitespace in descendant combinator, fixes #2410

* Permit whitespace changes in clean-ast.js
master
Lucas Azzola 2017-07-06 21:55:34 +10:00 committed by Christopher Chedeau
parent 86c88ff278
commit 82b80b3c79
7 changed files with 60 additions and 4 deletions

View File

@ -70,6 +70,10 @@ function massageAST(ast) {
delete newObj.params;
}
if (ast.type === "selector-combinator") {
newObj.value = newObj.value.replace(/\s+/g, " ");
}
if (ast.type === "media-feature") {
newObj.value = newObj.value.replace(/ /g, "");
}

View File

@ -212,7 +212,7 @@ function genericPrint(path, options, print) {
: line;
return concat([leading, n.value, " "]);
}
return n.value;
return n.value.trim() || line;
}
case "selector-universal": {
return n.value;

View File

@ -3,10 +3,34 @@
exports[`combinator.css 1`] = `
-Option/root .public/section ~ .public/section:before {
}
.x .y {}
.x > .y {}
.x ~ .y {}
.x + .y {}
.x.y {}
.x .y {}
.x
.y {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Option/root .public/section ~ .public/section:before {
}
.x .y {
}
.x > .y {
}
.x ~ .y {
}
.x + .y {
}
.x.y {
}
.x .y {
}
.x .y {
}
`;
exports[`leading.css 1`] = `

View File

@ -1,2 +1,11 @@
-Option/root .public/section ~ .public/section:before {
}
.x .y {}
.x > .y {}
.x ~ .y {}
.x + .y {}
.x.y {}
.x .y {}
.x
.y {}

View File

@ -96,14 +96,26 @@ exports[`selector.css 1`] = `
.powerPathNavigator table.powerPathInfo th:active,
.powerPathNavigator table.powerPathInfo th:active + th:last-child {
}
/* pressed buttons */
.powerPathNavigator .helm button.pressedButton,
.powerPathNavigator .helm button:active:not(.disabledButton) {
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.powerPathNavigator .helm button.pressedButton,
/* pressed buttons */
.powerPathNavigator .helm button:active:not(.disabledButton),
.powerPathNavigator
.helm
button:active:not(.disabledButton),
.powerPathNavigator table.powerPathInfo th:active,
.powerPathNavigator table.powerPathInfo th:active + th:last-child {
}
/* pressed buttons */
.powerPathNavigator .helm button.pressedButton,
.powerPathNavigator .helm button:active:not(.disabledButton) {
}
`;
exports[`trailing_star_slash.css 1`] = `

View File

@ -3,3 +3,8 @@
.powerPathNavigator table.powerPathInfo th:active,
.powerPathNavigator table.powerPathInfo th:active + th:last-child {
}
/* pressed buttons */
.powerPathNavigator .helm button.pressedButton,
.powerPathNavigator .helm button:active:not(.disabledButton) {
}

View File

@ -28,8 +28,10 @@ exports[`selectors.css 1`] = `
}
}
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas .asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas,
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas .asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas {
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas,
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas
.asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkas {
}
`;