improve `spoof-css`
In jQuery, height() and width() methods use Element.prototype.getBoundingClientRect to calculate size of an element.
However, AdGuard's spoof-css scriptlet does not mock completely the property.
Screenshot
As far as I understand, the problem occurs when 2 (or more) spoof-css scriptlets are used, for example:
example.org#%#//scriptlet('spoof-css', 'h1', 'width', '1000')
example.org#%#//scriptlet('spoof-css', 'h1', 'height', '2000')
and it looks like that the last one override/changes value set in previous scriptlet.
exploader.net uses getBoundingClientRect to bypass css rule to set left: -4000px etc.
Code snippet
let bounds = ele.getBoundingClientRect();
if (bounds.left < 0 || (bounds.right > window.innerWidth && window.innerWidth > 1200) || bounds.top < 0) {
window.d7ad0a5447d73fcf18574784d7f74 = false;
window.abf730d17dd9b673c7ef9c01d711de1 = false;
return;
}
uBO's fix that I confirmed working: https://github.com/gorhill/uBlock/commit/5f5e3d730f Should I open a new issue for this?
The changes related to https://github.com/AdguardTeam/Scriptlets/issues/498 should also fixes this issue.