5 * Check whether a type selector is standard
7 * @param {Node} postcss-selector-parser node (of type tag)
8 * @return {boolean} If `true`, the type selector is standard
11 const _ = require("lodash");
12 const keywordSets = require("../reference/keywordSets");
14 module.exports = function(node /*: Object*/) /*: boolean*/ {
15 // postcss-selector-parser includes the arguments to nth-child() functions
16 // as "tags", so we need to ignore them ourselves.
17 // The fake-tag's "parent" is actually a selector node, whose parent
18 // should be the :nth-child pseudo node.
19 const _node$parent$parent = node.parent.parent;
20 const parentType = _node$parent$parent.type,
21 parentValue = _node$parent$parent.value;
24 const normalisedParentName = parentValue.toLowerCase().replace(/:+/, "");
26 parentType === "pseudo" &&
27 (keywordSets.aNPlusBNotationPseudoClasses.has(normalisedParentName) ||
28 keywordSets.linguisticPseudoClasses.has(normalisedParentName))
34 // &-bar is a nesting selector combined with a suffix
35 if (node.prev() && node.prev().type === "nesting") {
39 if (node.value[0] === "%") {
43 // Reference combinators like `/deep/`
44 if (_.startsWith(node.value, "/") && _.endsWith(node.value, "/")) {