File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3458,6 +3458,8 @@ class ExtSelectorCompiler {
34583458
34593459 // https://github.com/uBlockOrigin/uBlock-issues/issues/2300
34603460 // Unquoted attribute values are parsed as Identifier instead of String.
3461+ // https://github.com/uBlockOrigin/uBlock-issues/issues/3127
3462+ // Escape [\t\n\v\f\r]
34613463 astSerializePart ( part ) {
34623464 const out = [ ] ;
34633465 const { data } = part ;
@@ -3473,7 +3475,14 @@ class ExtSelectorCompiler {
34733475 if ( typeof value !== 'string' ) {
34743476 value = data . value . name ;
34753477 }
3476- value = value . replace ( / [ " \\ ] / g, '\\$&' ) ;
3478+ if ( / [ " \\ ] / . test ( value ) ) {
3479+ value = value . replace ( / [ " \\ ] / g, '\\$&' ) ;
3480+ }
3481+ if ( / [ \x09 - \x0D ] / . test ( value ) ) {
3482+ value = value . replace ( / [ \x09 - \x0D ] / g, s =>
3483+ `\\${ s . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) } `
3484+ ) ;
3485+ }
34773486 let flags = '' ;
34783487 if ( typeof data . flags === 'string' ) {
34793488 if ( / ^ ( i s ? | s i ? ) $ / . test ( data . flags ) === false ) { return ; }
You can’t perform that action at this time.
0 commit comments