feat: ignore non standard IE filter values (#4028)

master
Evilebot Tnawi 2018-02-26 14:58:38 +03:00 committed by GitHub
parent b6c27893cc
commit 65b988a989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 42 deletions

View File

@ -279,6 +279,10 @@ function parseNestedCSS(node) {
}
}
if (value.startsWith("progid:")) {
return node;
}
node.value = parseValue(value);
} catch (e) {
throw createError(

View File

@ -391,14 +391,6 @@ function genericPrint(path, options, print) {
const printed = path.map(print, "groups");
const parts = [];
const hasProgidPrefix =
declAncestorNode &&
declAncestorNode.value.group &&
declAncestorNode.value.group.group &&
declAncestorNode.value.group.group.groups &&
declAncestorNode.value.group.group.groups[0] &&
declAncestorNode.value.group.group.groups[0].type === "value-word" &&
declAncestorNode.value.group.group.groups[0].value === "progid";
const functionAncestorNode = getAncestorNode(path, "value-func");
const insideInFunction =
functionAncestorNode && functionAncestorNode.value;
@ -429,15 +421,6 @@ function genericPrint(path, options, print) {
continue;
}
// Ignore `filter: progid:DXImageTransform.Microsoft.Gradient(params);`
if (
hasProgidPrefix &&
iNode.type === "value-word" &&
iNode.value.endsWith("=")
) {
continue;
}
// Ignore `@` in Less (i.e. `@@var;`)
if (iNode.type === "value-atword" && iNode.value === "") {
continue;
@ -602,7 +585,7 @@ function genericPrint(path, options, print) {
return group(indent(concat(parts)));
}
return group(hasProgidPrefix ? fill(parts) : indent(fill(parts)));
return group(indent(fill(parts)));
}
case "value-paren_group": {
const parentNode = path.getParentNode();
@ -685,15 +668,7 @@ function genericPrint(path, options, print) {
return node.value;
}
case "value-colon": {
const parent = path.getParentNode();
const index = getNodeIndex(path, node);
const hasProgidPrefix =
parent.groups[index - 1] && parent.groups[index - 1].value === "progid";
return concat([
node.value,
hasProgidPrefix || insideURLFunctionNode(path) ? "" : line
]);
return concat([node.value, insideURLFunctionNode(path) ? "" : line]);
}
case "value-comma": {
return concat([node.value, " "]);
@ -757,16 +732,6 @@ function insideURLFunctionNode(path) {
);
}
function getNodeIndex(path, node) {
const parent = path.getParentNode();
return (
parent &&
parent.groups &&
parent.groups.length > 0 &&
parent.groups.indexOf(node)
);
}
function isParenGroupNode(node) {
return node.type && node.type === "value-paren_group";
}

View File

@ -287,6 +287,12 @@ a {
)
;
}
.bar {
filter: progid:DXImageTransform.Microsoft.gradient(enabled='false',startColorstr='#fff',endColorstr='#000');
filter: progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=45, Strength=6) progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=135, Strength=6);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a {
prop1: func(1px, 1px, 1px, func(1px, 1px, 1px, func(1px, 1px, 1px)));
@ -485,4 +491,10 @@ a {
prop25: attr(data-size em, 20);
}
.bar {
filter: progid:DXImageTransform.Microsoft.gradient(enabled='false',startColorstr='#fff',endColorstr='#000');
filter: progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=45, Strength=6) progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=135, Strength=6);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)";
}
`;

View File

@ -284,3 +284,9 @@ a {
)
;
}
.bar {
filter: progid:DXImageTransform.Microsoft.gradient(enabled='false',startColorstr='#fff',endColorstr='#000');
filter: progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=45, Strength=6) progid:DXImageTransform.Microsoft.Shadow(color='#042b47', Direction=135, Strength=6);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)";
}

View File

@ -1478,11 +1478,7 @@ $icons: wifi "\\600", wifi-hotspot "\\601", weather "\\602";
prop10: #010203 + #040506;
prop11: #010203 * 2;
prop12: rgba(255, 0, 0, 0.75) + rgba(0, 255, 0, 0.75);
prop13: progid:DXImageTransform.Microsoft.gradient(
enabled="false",
startColorstr="#{ie-hex-str($green)}",
endColorstr="#{ie-hex-str($translucent-red)}"
);
prop13: progid:DXImageTransform.Microsoft.gradient(enabled='false', startColorstr='#{ie-hex-str($green)}', endColorstr='#{ie-hex-str($translucent-red)}');
prop14: e + -resize;
prop15: sans- + "serif";
prop16: 1em + (2em * 3);