From 6e78ee096a8c035f5819325d5b6465b915008c60 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 11 Jul 2023 15:10:27 -0400 Subject: [PATCH] Fix handling of empty strings for `set`/`set-attr` scriptlets Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2729 --- assets/resources/scriptlets.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 8128efbfb..4a16cd87b 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -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; }