@@ -47,6 +47,7 @@ import { skip_whitespace_forward, skip_whitespace_and_comments_forward, skip_whi
4747import {
4848 is_whitespace ,
4949 is_vendor_prefixed ,
50+ str_equals ,
5051 CHAR_PLUS ,
5152 CHAR_TILDE ,
5253 CHAR_GREATER_THAN ,
@@ -751,16 +752,16 @@ export class SelectorParser {
751752 // Parse the content inside the parentheses
752753 if ( content_end > content_start ) {
753754 // Check if this is an nth-* pseudo-class
754- let func_name = this . source . substring ( func_name_start , func_name_end ) . toLowerCase ( )
755+ let func_name_substr = this . source . substring ( func_name_start , func_name_end )
755756
756- if ( this . is_nth_pseudo ( func_name ) ) {
757+ if ( this . is_nth_pseudo ( func_name_substr ) ) {
757758 // Parse as An+B expression
758759 let child = this . parse_nth_expression ( content_start , content_end )
759760 if ( child !== null ) {
760761 this . arena . set_first_child ( node , child )
761762 this . arena . set_last_child ( node , child )
762763 }
763- } else if ( func_name === 'lang' ) {
764+ } else if ( str_equals ( 'lang' , func_name_substr ) ) {
764765 // Parse as :lang() - comma-separated language identifiers
765766 this . parse_lang_identifiers ( content_start , content_end , node )
766767 } else {
@@ -771,7 +772,7 @@ export class SelectorParser {
771772
772773 // Recursively parse the content as a selector
773774 // Only :has() accepts relative selectors (starting with combinator)
774- let allow_relative = func_name === 'has'
775+ let allow_relative = str_equals ( 'has' , func_name_substr )
775776 let child_selector = this . parse_selector ( content_start , content_end , this . lexer . line , this . lexer . column , allow_relative )
776777
777778 // Restore lexer state and selector_end
@@ -792,12 +793,12 @@ export class SelectorParser {
792793 // Check if pseudo-class name is an nth-* pseudo
793794 private is_nth_pseudo ( name : string ) : boolean {
794795 return (
795- name === 'nth-child' ||
796- name === 'nth-last-child' ||
797- name === 'nth-of-type' ||
798- name === 'nth-last-of-type' ||
799- name === 'nth-col' ||
800- name === 'nth-last-col'
796+ str_equals ( 'nth-child' , name ) ||
797+ str_equals ( 'nth-last-child' , name ) ||
798+ str_equals ( 'nth-of-type' , name ) ||
799+ str_equals ( 'nth-last-of-type' , name ) ||
800+ str_equals ( 'nth-col' , name ) ||
801+ str_equals ( 'nth-last-col' , name )
801802 )
802803 }
803804
0 commit comments