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

master
Evilebot Tnawi 2018-02-12 18:39:03 +03:00 committed by GitHub
parent 1ca4e2b90a
commit ec4f4eb6d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 2 deletions

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"))));

View File

@ -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|* {
}
*|* {
}
|* {
}
`;

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|* {}
*|* {}
|* {}