-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Basic info:
- Node.js version: 18.12.1
- jsdom version: 20.0.3
Minimal reproduction case
import { JSDOM } from "jsdom";
const dom = new JSDOM(`<div></div>`, {});
// @ts-ignore
const { document } = dom.window;
const div = document.querySelector("div");
const handleClick = (event) => {
const { x, y, clientX, clientY } = event;
console.log(`x: ${x}`);
console.log(`y: ${y}`);
console.log(`clientX: ${clientX}`);
console.log(`clientY: ${clientY}`);
};
div.addEventListener("click", handleClick);
const event = new MouseEvent("click", {
clientX: 10,
clientY: 20,
});
div.dispatchEvent(event);How does similar code behave in browsers?
x and y properties are printed to the console
Specification
Link: https://www.w3.org/TR/cssom-view-1/#extensions-to-the-mouseevent-interface
The x attribute must return the value of [clientX](https://www.w3.org/TR/cssom-view-1/#dom-mouseevent-clientx).
The y attribute must return the value of [clientY](https://www.w3.org/TR/cssom-view-1/#dom-mouseevent-clienty).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

