4 const isStandardSyntaxValue = require("./isStandardSyntaxValue");
5 const isVariable = require("./isVariable");
6 const keywordSets = require("../reference/keywordSets");
7 const postcssValueParser = require("postcss-value-parser");
10 * Get the list-style-type within a `list-style` shorthand property value.
12 module.exports = function findListStyleType(
14 ) /*: Array<Object>*/ {
15 const listStyleTypes = [];
17 const valueNodes = postcssValueParser(value);
19 // Handle `inherit`, `initial` and etc
21 valueNodes.nodes.length === 1 &&
22 keywordSets.listStyleTypeKeywords.has(
23 valueNodes.nodes[0].value.toLowerCase()
26 return [valueNodes.nodes[0]];
29 valueNodes.walk(valueNode => {
30 if (valueNode.type === "function") {
33 if (valueNode.type !== "word") {
37 const valueLowerCase = valueNode.value.toLowerCase();
39 // Ignore non standard syntax
40 if (!isStandardSyntaxValue(valueLowerCase)) {
44 if (isVariable(valueLowerCase)) {
47 // Ignore keywords for other font parts
49 keywordSets.listStylePositionKeywords.has(valueLowerCase) ||
50 keywordSets.listStyleImageKeywords.has(valueLowerCase)
55 listStyleTypes.push(valueNode);
58 return listStyleTypes;