File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -410,7 +410,12 @@ impl ToCss for NonTSPseudoClass {
410410 Self :: UserValid => ":user-valid" ,
411411 Self :: Valid => ":valid" ,
412412 Self :: Visited => ":visited" ,
413- Self :: Lang ( _) | Self :: CustomState ( _) => unreachable ! ( ) ,
413+ NonTSPseudoClass :: CustomState ( ref state) => {
414+ dest. write_str ( ":state(" ) ?;
415+ state. 0 . to_css ( dest) ?;
416+ return dest. write_char ( ')' ) ;
417+ } ,
418+ Self :: Lang ( _) => unreachable ! ( ) ,
414419 } )
415420 }
416421}
@@ -597,10 +602,13 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
597602 parser : & mut CssParser < ' i , ' t > ,
598603 after_part : bool ,
599604 ) -> Result < NonTSPseudoClass , ParseError < ' i > > {
600- use self :: NonTSPseudoClass :: * ;
601605 let pseudo_class = match_ignore_ascii_case ! { & name,
602606 "lang" if !after_part => {
603- Lang ( parser. expect_ident_or_string( ) ?. as_ref( ) . into( ) )
607+ NonTSPseudoClass :: Lang ( parser. expect_ident_or_string( ) ?. as_ref( ) . into( ) )
608+ } ,
609+ "state" => {
610+ let result = AtomIdent :: from( parser. expect_ident( ) ?. as_ref( ) ) ;
611+ NonTSPseudoClass :: CustomState ( CustomState ( result) )
604612 } ,
605613 _ => return Err ( parser. new_custom_error( SelectorParseErrorKind :: UnexpectedIdent ( name. clone( ) ) ) ) ,
606614 } ;
You can’t perform that action at this time.
0 commit comments