@@ -3,7 +3,7 @@ import MasterCSS from '../core'
33import parsePair from './parse-pair'
44
55export declare type SelectorLiteralNode = {
6- type ?: 'attribute' | 'pseudo-class' | 'pseudo-element' | 'class' | 'universal'
6+ type ?: 'attribute' | 'pseudo-class' | 'pseudo-element' | 'class' | 'universal' | 'id'
77 raw ?: string
88 value ?: string
99 children ?: SelectorNode [ ]
@@ -23,7 +23,7 @@ export declare type SelectorCombinatorNode = {
2323
2424export declare type SelectorNode = SelectorLiteralNode | SelectorCombinatorNode | SelectorSeparatorNode
2525
26- const SELECTOR_REGEX = new RegExp ( `(?:[a-zA-Z0-9-]+)|([${ SELECTOR_COMBINATORS . join ( '' ) } .:,*])|(a-zA-Z0-9-)` , 'g' )
26+ const SELECTOR_REGEX = new RegExp ( `(?:[a-zA-Z0-9-]+)|([${ SELECTOR_COMBINATORS . join ( '' ) } # .:,*])|(a-zA-Z0-9-)` , 'g' )
2727
2828export default function parseSelector ( token : string , css = new MasterCSS ( ) , isRaw = true ) {
2929 const resolve = ( eachToken : string ) : SelectorNode [ ] => {
@@ -35,7 +35,7 @@ export default function parseSelector(token: string, css = new MasterCSS(), isRa
3535 const raw = match [ 0 ]
3636 tokenIndex += raw . length
3737
38- if ( raw === ':' || raw === '.' ) {
38+ if ( raw === ':' || raw === '.' || raw === '#' ) {
3939 currentPrefix += raw
4040 continue
4141 }
@@ -73,6 +73,8 @@ export default function parseSelector(token: string, css = new MasterCSS(), isRa
7373 type = 'pseudo-element'
7474 } else if ( currentPrefix === '.' ) {
7575 type = 'class'
76+ } else if ( currentPrefix === '#' ) {
77+ type = 'id'
7678 }
7779
7880 nodes . push ( {
0 commit comments