mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Fix handling of empty strings for set
/set-attr
scriptlets
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2729
This commit is contained in:
parent
4a83b80328
commit
6e78ee096a
1 changed files with 2 additions and 3 deletions
|
@ -400,7 +400,7 @@ function setConstantCore(
|
|||
cValue = true;
|
||||
} else if ( cValue === 'null' ) {
|
||||
cValue = null;
|
||||
} else if ( cValue === "''" ) {
|
||||
} else if ( cValue === "''" || cValue === '' ) {
|
||||
cValue = '';
|
||||
} else if ( cValue === '[]' ) {
|
||||
cValue = [];
|
||||
|
@ -2994,12 +2994,11 @@ function setAttr(
|
|||
) {
|
||||
if ( typeof selector !== 'string' ) { return; }
|
||||
if ( selector === '' ) { return; }
|
||||
if ( value === '' ) { return; }
|
||||
|
||||
const validValues = [ '', 'false', 'true' ];
|
||||
let copyFrom = '';
|
||||
|
||||
if ( validValues.includes(value) === false ) {
|
||||
if ( validValues.includes(value.toLowerCase()) === false ) {
|
||||
if ( /^\d+$/.test(value) ) {
|
||||
const n = parseInt(value, 10);
|
||||
if ( n >= 32768 ) { return; }
|
||||
|
|
Loading…
Reference in a new issue