-
Notifications
You must be signed in to change notification settings - Fork 83
/
PseudoElement.js
35 lines (30 loc) · 995 Bytes
/
PseudoElement.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var List = require('../../utils/list');
var TYPE = require('../../scanner').TYPE;
var COLON = TYPE.Colon;
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
var ABSOLUTE = false;
var DISALLOW_COMBINATORS = true;
// :: ident
module.exports = function PseudoElement() {
var start = this.scanner.tokenStart;
var name;
var children = null;
this.scanner.eat(COLON);
this.scanner.eat(COLON);
// https://drafts.csswg.org/css-scoping/#slotted-pseudo
if (this.scanner.lookupValue(0, 'slotted')) {
name = this.readIdent(false);
this.scanner.eat(LEFTPARENTHESIS);
children = new List().appendData(this.Selector(ABSOLUTE, DISALLOW_COMBINATORS));
this.scanner.eat(RIGHTPARENTHESIS);
} else {
name = this.readIdent(false);
}
return {
type: 'PseudoElement',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
children: children
};
};