@@ -935,7 +935,7 @@ export function mightCreateNewElement(before: string, after: string): boolean {
935935 if (
936936 ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \\ [ 1 - 9 ] \d * $ / u. test ( before ) &&
937937 / ^ \d / u. test ( after ) ) ||
938- ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \\ k $ / u. test ( before ) && after . startsWith ( "<" ) ) ||
938+ ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \\ k $ / u. test ( before ) && after [ 0 ] === "<" ) ||
939939 / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \\ k < [ ^ < > ] * $ / u. test ( before )
940940 ) {
941941 return true
@@ -959,8 +959,7 @@ export function mightCreateNewElement(before: string, after: string): boolean {
959959 / ^ [ \d , } ] / u. test ( after ) ) ||
960960 ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \{ \d + , $ / u. test ( before ) &&
961961 / ^ (?: \d + (?: \} | $ ) | \} ) / u. test ( after ) ) ||
962- ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \{ \d + , \d * $ / u. test ( before ) &&
963- after . startsWith ( "}" ) )
962+ ( / (?: ^ | [ ^ \\ ] ) (?: \\ { 2 } ) * \{ \d + , \d * $ / u. test ( before ) && after [ 0 ] === "}" )
964963 ) {
965964 return true
966965 }
@@ -1014,13 +1013,13 @@ export function fixRemoveCharacterClassElement(
10141013 if (
10151014 // ... the text character is a dash
10161015 // e.g. [a\w-b] -> [a\-b], [\w-b] -> [-b], [\s\w-b] -> [\s-b]
1017- ( textAfter . startsWith ( "-" ) &&
1016+ ( textAfter [ 0 ] === "-" &&
10181017 elementBefore &&
10191018 elementBefore . type === "Character" ) ||
10201019 // ... the next character is a caret and the caret will then be the
10211020 // first character in the character class
10221021 // e.g. [a^b] -> [\^b], [ba^] -> [b^]
1023- ( textAfter . startsWith ( "^" ) && ! cc . negate && ! elementBefore )
1022+ ( textAfter [ 0 ] === "^" && ! cc . negate && ! elementBefore )
10241023 ) {
10251024 return "\\"
10261025 }
0 commit comments