travel/admin/node_modules/css-tree/lib/syntax/scope/selector.js

57 lines
1.4 KiB
JavaScript

var TYPE = require('../../tokenizer').TYPE;
var IDENTIFIER = TYPE.Identifier;
var NUMBER = TYPE.Number;
var NUMBERSIGN = TYPE.NumberSign;
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
var PLUSSIGN = TYPE.PlusSign;
var SOLIDUS = TYPE.Solidus;
var ASTERISK = TYPE.Asterisk;
var FULLSTOP = TYPE.FullStop;
var COLON = TYPE.Colon;
var GREATERTHANSIGN = TYPE.GreaterThanSign;
var VERTICALLINE = TYPE.VerticalLine;
var TILDE = TYPE.Tilde;
function getNode(context) {
switch (this.scanner.tokenType) {
case PLUSSIGN:
case GREATERTHANSIGN:
case TILDE:
context.space = null;
context.ignoreWSAfter = true;
return this.Combinator();
case SOLIDUS: // /deep/
return this.Combinator();
case FULLSTOP:
return this.ClassSelector();
case LEFTSQUAREBRACKET:
return this.AttributeSelector();
case NUMBERSIGN:
return this.IdSelector();
case COLON:
if (this.scanner.lookupType(1) === COLON) {
return this.PseudoElementSelector();
} else {
return this.PseudoClassSelector();
}
case IDENTIFIER:
case ASTERISK:
case VERTICALLINE:
return this.TypeSelector();
case NUMBER:
return this.Percentage();
}
};
module.exports = {
getNode: getNode
};