aboutsummaryrefslogtreecommitdiffstats
path: root/src/selector/filterMatchExpr.js
blob: 65675bd40a3c481c26b3c2c08b726224f63e1ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { whitespace } from "../var/whitespace.js";
import { identifier } from "./var/identifier.js";
import { attributes } from "./var/attributes.js";
import { pseudos } from "./var/pseudos.js";

export var filterMatchExpr = {
	ID: new RegExp( "^#(" + identifier + ")" ),
	CLASS: new RegExp( "^\\.(" + identifier + ")" ),
	TAG: new RegExp( "^(" + identifier + "|[*])" ),
	ATTR: new RegExp( "^" + attributes ),
	PSEUDO: new RegExp( "^" + pseudos ),
	CHILD: new RegExp(
		"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
		whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
		whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" )
};