fix(css): don't eat selector namespace (#3956)

This commit is contained in:
Evilebot Tnawi authored and GitHub committed 2018-02-12 18:39:03 +03:00
1 parent 1ca4e2b90a
commit ec4f4eb6d3
3 files changed
+70 -2

No files matched your search

+12 -2
View File
@@ -309,7 +309,12 @@ function genericPrint(path, options, print) {
return adjustStrings(node.value, options);
}
case "selector-tag": {
return adjustNumbers(node.value);
return concat([
node.namespace
? concat([node.namespace === true ? "" : node.namespace.trim(), "|"])
: "",
adjustNumbers(node.value)
]);
}
case "selector-id": {
return concat(["#", node.value]);
@@ -358,7 +363,12 @@ function genericPrint(path, options, print) {
return concat([leading, value]);
}
case "selector-universal": {
return node.value;
return concat([
node.namespace
? concat([node.namespace === true ? "" : node.namespace.trim(), "|"])
: "",
adjustNumbers(node.value)
]);
}
case "selector-selector": {
return group(indent(concat(path.map(print, "nodes"))));
@@ -295,6 +295,23 @@ exports[`selectors.css 1`] = `
>>> .child-one {}
>>> .child-two {}
}
/* This matches all XHTML <a> elements, as XHTML is the default unprefixed namespace */
a {}
/* This matches all SVG <a> elements */
svg|a {}
/* This matches both XHTML and SVG <a> elements */
*|a {}
|B {}
ns|* {}
*|* {}
|* {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.a,
.b,
@@ -660,4 +677,28 @@ exports[`selectors.css 1`] = `
}
}
/* This matches all XHTML <a> elements, as XHTML is the default unprefixed namespace */
a {
}
/* This matches all SVG <a> elements */
svg|a {
}
/* This matches both XHTML and SVG <a> elements */
*|a {
}
|B {
}
ns|* {
}
*|* {
}
|* {
}
`;
+17
View File
@@ -292,3 +292,20 @@
>>> .child-one {}
>>> .child-two {}
}
/* This matches all XHTML <a> elements, as XHTML is the default unprefixed namespace */
a {}
/* This matches all SVG <a> elements */
svg|a {}
/* This matches both XHTML and SVG <a> elements */
*|a {}
|B {}
ns|* {}
*|* {}
|* {}