1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-03 02:37:21 +02:00

Mind that attribute names are case-insensitive

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3121
This commit is contained in:
Raymond Hill 2024-02-14 08:37:01 -05:00
parent b22b3d729b
commit 50ebfb9932
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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}"`);
}