UNPKG

css-tree

Version:

A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations

35 lines (26 loc) 628 B
import { Comma } from '../../tokenizer/index.js'; export const name = 'MediaQueryList'; export const structure = { children: [[ 'MediaQuery' ]] }; export function parse() { const children = this.createList(); this.skipSC(); while (!this.eof) { children.push(this.MediaQuery()); if (this.tokenType !== Comma) { break; } this.next(); } return { type: 'MediaQueryList', loc: this.getLocationFromList(children), children }; } export function generate(node) { this.children(node, () => this.token(Comma, ',')); }