对于一开始的两个正则看不明白
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
想知道如何才算是attributes
,pseudos
,
特别不理解的是其中匹配的 引号内 斜杠加任意字符 如链接1里面的group3
链接打不上,Regulex
第一个的正则\[(?:whitespace)*((?:identifier))(?:(?:whitespace)*([*^$|!~]?=)(?:whitespace)*(?:'((?:\\.|[^\\'])*)'|\"((?:\\.|[^\\\"])*)\"|((?:identifier)))|)(?:whitespace)*\]
第二个的正则:((?:identifier)=)(?:\((('((?:\\.|[^\\'])*)'|\"((?:\\.|[^\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|(?:attributes))*)|.*)\)|)
http://www.w3.org/TR/selector...