a CSS selector parser\hypertarget{md_sfcode_node_modules_css_what_readme_autotoc_md7361}{}\doxysection{Example}\label{md_sfcode_node_modules_css_what_readme_autotoc_md7361}

\begin{DoxyCode}{0}
\DoxyCodeLine{const CSSwhat = require("{}css-\/what"{})}
\DoxyCodeLine{CSSwhat.parse("{}foo[bar]:baz"{})}
\DoxyCodeLine{}
\DoxyCodeLine{\string~> [}
\DoxyCodeLine{    [}
\DoxyCodeLine{        \{ type: "{}tag"{}, name: "{}foo"{} \},}
\DoxyCodeLine{        \{}
\DoxyCodeLine{            type: "{}attribute"{},}
\DoxyCodeLine{            name: "{}bar"{},}
\DoxyCodeLine{            action: "{}exists"{},}
\DoxyCodeLine{            value: "{}"{},}
\DoxyCodeLine{            ignoreCase: false}
\DoxyCodeLine{        \},}
\DoxyCodeLine{        \{ type: "{}pseudo"{}, name: "{}baz"{}, data: null \}}
\DoxyCodeLine{    ]}
\DoxyCodeLine{] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_css_what_readme_autotoc_md7362}{}\doxysection{API}\label{md_sfcode_node_modules_css_what_readme_autotoc_md7362}
$\ast$$\ast${\ttfamily CSSwhat.\+parse(str, options)} -\/ Parses {\ttfamily str}, optionally with the passed {\ttfamily options}.$\ast$$\ast$

The function returns a two-\/dimensional array. The first array represents selectors separated by commas (eg. {\ttfamily sub1, sub2}), the second contains the relevant tokens for that selector. Possible token types are\+:

\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{4}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ name   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ attributes   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ example   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ output    }\\\cline{1-4}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ name   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ attributes   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ example   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ output    }\\\cline{1-4}
\endhead
{\ttfamily tag}   &{\ttfamily name}   &{\ttfamily div}   &`\{ type\+: \textquotesingle{}tag', name\+: \textquotesingle{}div\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}universal{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}$\ast${\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}universal\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}pseudo{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}data{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\+:name(data){\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}pseudo\textquotesingle{}, name\+: \textquotesingle{}name\textquotesingle{}, data\+: \textquotesingle{}data\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}pseudo{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}data{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\+:name{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}pseudo\textquotesingle{}, name\+: \textquotesingle{}name\textquotesingle{}, data\+: null \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}pseudo-\/element{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\+::name$<$tt$>$\textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$\{ type\+: \textquotesingle{}pseudo-\/element\textquotesingle{}, name\+: \textquotesingle{}name\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}attribute{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}action{\ttfamily ,}value{\ttfamily ,}ignore\+Case{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\mbox{[}attr\mbox{]}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}attribute\textquotesingle{}, name\+: \textquotesingle{}attr\textquotesingle{}, action\+: \textquotesingle{}exists\textquotesingle{}, value\+: \textquotesingle{}\textquotesingle{}, ignore\+Case\+: false \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}attribute{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}action{\ttfamily ,}value{\ttfamily ,}ignore\+Case{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\mbox{[}attr=val\mbox{]}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}attribute\textquotesingle{}, name\+: \textquotesingle{}attr\textquotesingle{}, action\+: \textquotesingle{}equals\textquotesingle{}, value\+: \textquotesingle{}val\textquotesingle{}, ignore\+Case\+: false \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}attribute{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}action{\ttfamily ,}value{\ttfamily ,}ignore\+Case{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\mbox{[}attr$^\wedge$=val\mbox{]}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}attribute\textquotesingle{}, name\+: \textquotesingle{}attr\textquotesingle{}, action\+: \textquotesingle{}start\textquotesingle{}, value\+: \textquotesingle{}val\textquotesingle{}, ignore\+Case\+: false \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}attribute{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}name{\ttfamily ,}action{\ttfamily ,}value{\ttfamily ,}ignore\+Case{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\mbox{[}attr\$=val\mbox{]}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}attribute\textquotesingle{}, name\+: \textquotesingle{}attr\textquotesingle{}, action\+: \textquotesingle{}end\textquotesingle{}, value\+: \textquotesingle{}val\textquotesingle{}, ignore\+Case\+: false \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}child{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}$>${\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}child\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}parent{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}$<${\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}parent\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}sibling{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}$\sim${\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}sibling\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Odd\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}adjacent{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}+{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}adjacent\textquotesingle{} \}{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$/tr$>$ $<$tr class=\char`\"{}markdown\+Table\+Row\+Even\char`\"{}$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}descendant{\ttfamily \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ -\/ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$ \textbackslash{}ilinebr $<$/td$>$ $<$td class=\char`\"{}markdown\+Table\+Body\+None\char`\"{}$>$}\{ type\+: \textquotesingle{}descendant\textquotesingle{} \}\`{}   \\\cline{1-4}
\end{longtabu}


{\bfseries{Options\+:}}


\begin{DoxyItemize}
\item {\ttfamily lower\+Case\+Tags}\+: When false, tag names will not be lowercased. Defaults to {\ttfamily true}.
\item {\ttfamily lower\+Case\+Attribute\+Names}\+: When false, attribute names will not be lowercased. Defaults to {\ttfamily true}.
\item {\ttfamily xml\+Mode}\+: When {\ttfamily true}, {\ttfamily xml\+Mode} implies both {\ttfamily lower\+Case\+Tags} and {\ttfamily lower\+Case\+Attribute\+Names} are set to {\ttfamily false}.
\end{DoxyItemize}

$\ast$$\ast${\ttfamily CSSwhat.\+stringify(selector)} -\/ Turns {\ttfamily selector} back into a string.$\ast$$\ast$

\DoxyHorRuler{0}


License\+: BSD-\/2-\/\+Clause\hypertarget{md_sfcode_node_modules_css_what_readme_autotoc_md7364}{}\doxysection{Security contact information}\label{md_sfcode_node_modules_css_what_readme_autotoc_md7364}
To report a security vulnerability, please use the \href{https://tidelift.com/security}{\texttt{ Tidelift security contact}}. Tidelift will coordinate the fix and disclosure.\hypertarget{md_sfcode_node_modules_css_what_readme_autotoc_md7365}{}\doxysection{$<$tt$>$css-\/what$<$/tt$>$ for enterprise}\label{md_sfcode_node_modules_css_what_readme_autotoc_md7365}
Available as part of the Tidelift Subscription

The maintainers of {\ttfamily css-\/what} and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. \href{https://tidelift.com/subscription/pkg/npm-css-what?utm_source=npm-css-what&utm_medium=referral&utm_campaign=enterprise&utm_term=repo}{\texttt{ Learn more.}} 