b79bf0cb by Adam Heath

Add a ::content pseudo-element.

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