Skip to content

Truly independent web browser

2.4 KB
Raw Blame
// https://w3c.github.io/uievents/#mouseevent
[Exposed=Window]
interface MouseEvent : UIEvent {
    constructor(DOMString type, optional MouseEventInit eventInitDict = {});

    // https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
    readonly attribute double screenX;
    readonly attribute double screenY;
    readonly attribute double pageX;
    readonly attribute double pageY;
    readonly attribute double clientX;
    readonly attribute double clientY;
    readonly attribute double x;
    readonly attribute double y;
    readonly attribute double offsetX;
    readonly attribute double offsetY;

    readonly attribute boolean ctrlKey;
    readonly attribute boolean shiftKey;
    readonly attribute boolean altKey;
    readonly attribute boolean metaKey;

    // https://w3c.github.io/pointerlock/#extensions-to-the-mouseevent-interface
    readonly attribute double movementX;
    readonly attribute double movementY;

    readonly attribute short button;
    readonly attribute unsigned short buttons;

    [DirectGetter] readonly attribute EventTarget? relatedTarget;

    readonly attribute Node? fromElement;
    readonly attribute Node? toElement;

    boolean getModifierState([FlyString] DOMString keyArg);

    // https://w3c.github.io/uievents/#dom-mouseevent-initmouseevent
    // FIXME: Spec issue: We use a WindowProxy instead of a Window: https://github.com/w3c/uievents/issues/388
    undefined initMouseEvent([FlyString] DOMString typeArg, optional boolean bubblesArg = false, optional boolean cancelableArg = false, optional WindowProxy? viewArg = null, optional long detailArg = 0, optional long screenXArg = 0, optional long screenYArg = 0, optional long clientXArg = 0, optional long clientYArg = 0, optional boolean ctrlKeyArg = false, optional boolean altKeyArg = false, optional boolean shiftKeyArg = false, optional boolean metaKeyArg = false, optional short buttonArg = 0, optional EventTarget? relatedTargetArg = null);
};

// https://w3c.github.io/uievents/#idl-mouseeventinit
dictionary MouseEventInit : EventModifierInit {
    // https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
    double screenX = 0;
    double screenY = 0;
    double clientX = 0;
    double clientY = 0;

    // https://w3c.github.io/pointerlock/#extensions-to-the-mouseeventinit-dictionary
    double movementX = 0;
    double movementY = 0;

    short button = 0;
    unsigned short buttons = 0;
    EventTarget? relatedTarget = null;
};