Improve logging in prevent-addEventListener scriptlet

Related feedback:
https://github.com/uBlockOrigin/uAssets/discussions/17907#discussioncomment-9871079
This commit is contained in:
Raymond Hill 2024-06-25 09:08:46 -04:00
parent 88065d0091
commit 8eb3b19c69
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1661,7 +1661,9 @@ function addEventListenerDefuser(
if ( elem instanceof Document ) { return 'document'; } if ( elem instanceof Document ) { return 'document'; }
if ( elem instanceof Element === false ) { return '?'; } if ( elem instanceof Element === false ) { return '?'; }
const parts = []; const parts = [];
if ( elem.id !== '' ) { parts.push(`#${CSS.escape(elem.id)}`); } // https://github.com/uBlockOrigin/uAssets/discussions/17907#discussioncomment-9871079
const id = String(elem.id);
if ( id !== '' ) { parts.push(`#${CSS.escape(id)}`); }
for ( let i = 0; i < elem.classList.length; i++ ) { for ( let i = 0; i < elem.classList.length; i++ ) {
parts.push(`.${CSS.escape(elem.classList.item(i))}`); parts.push(`.${CSS.escape(elem.classList.item(i))}`);
} }