From 50ebfb9932491a0db9c89e148f2280c609a6242e Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 14 Feb 2024 08:37:01 -0500 Subject: [PATCH] Mind that attribute names are case-insensitive Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3121 --- assets/resources/scriptlets.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 0bc532607..a6c1a316b 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -3844,7 +3844,9 @@ function setAttr( const before = elem.getAttribute(attr); const after = extractValue(elem); if ( after === before ) { continue; } - if ( attr.startsWith('on') && attr in elem && after !== '' ) { continue; } + if ( after !== '' && /^on/i.test(attr) ) { + if ( attr.toLowerCase() in elem ) { continue; } + } elem.setAttribute(attr, after); safe.uboLog(logPrefix, `${attr}="${after}"`); }