b79bf0cb by Adam Heath

Add a ::content pseudo-element.

1 parent 06a33897
......@@ -23,6 +23,7 @@ export const PSEUDO_ELEMENT = Symbol('PSEUDO_ELEMENT')
export const PSEUDO_ELEMENTS = {
after: { type: PSEUDO_ELEMENT, name: '::after' },
before: { type: PSEUDO_ELEMENT, name: '::before' },
content: { type: PSEUDO_ELEMENT, name: '::content' },
}
export const fixAttributes = (attributes, options = { mapClassname: true }) => {
......@@ -304,6 +305,8 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
return (context, node, parent, i, debug, special) => special === PSEUDO_ELEMENTS.after
case 'before':
return (context, node, parent, i, debug, special) => special === PSEUDO_ELEMENTS.before
case 'content':
return (context, node, parent, i, debug, special) => special === PSEUDO_ELEMENTS.content
default:
console.error('pseudo-class', nodeUtil.inspect({ selector, ast }, { depth: null, colors: true }))
throw new Error(`Unknown pseudo-class: ${ast.name}`)
......