Skip to content

Fix 'spoof-css' — DOMRect is set incorrectly #498

@AdamWr

Description

@AdamWr

Steps to reproduce:

  1. Add this rule:
example.org#%#//scriptlet('spoof-css', 'body', 'visibility', 'hidden')
  1. Go to - https://example.org/
  2. In browser console run:
const { height, width } = document.body.getBoundingClientRect();
console.log('height:', height);
console.log('width:', width);

width returns incorrect value.
It's probably due to this line:

const newDOMRect = new window.DOMRect(rect.x, rect.y, top, bottom, width, height, left, right);

and perhaps should be changed to:

 const newDOMRect = new window.DOMRect(rect.x, rect.y, width, height);

https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/DOMRect

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions