Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Commit 24e6d2a

Browse files
Steditorbethge
authored andcommitted
Set button property to -1 if no mouse button is depressed
Ref gh-242 Fixes gh-173 Closes gh-267
1 parent 72c36f7 commit 24e6d2a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/mouse.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var mouseEvents = {
8787
if (!this.isEventSimulatedFromTouch(inEvent)) {
8888
var e = this.prepareEvent(inEvent);
8989
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
90+
e.button = -1;
9091
dispatcher.move(e);
9192
}
9293
},
@@ -109,7 +110,8 @@ var mouseEvents = {
109110
// FF Ubuntu includes the lifted button in the `buttons` property on
110111
// mouseup.
111112
// https://bugzilla.mozilla.org/show_bug.cgi?id=1223366
112-
if (e.buttons === 0 || e.buttons === BUTTON_TO_BUTTONS[e.button]) {
113+
e.buttons &= ~BUTTON_TO_BUTTONS[e.button];
114+
if (e.buttons === 0) {
113115
this.cleanupMouse();
114116
dispatcher.up(e);
115117
} else {
@@ -121,13 +123,15 @@ var mouseEvents = {
121123
if (!this.isEventSimulatedFromTouch(inEvent)) {
122124
var e = this.prepareEvent(inEvent);
123125
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
126+
e.button = -1;
124127
dispatcher.enterOver(e);
125128
}
126129
},
127130
mouseout: function(inEvent) {
128131
if (!this.isEventSimulatedFromTouch(inEvent)) {
129132
var e = this.prepareEvent(inEvent);
130133
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
134+
e.button = -1;
131135
dispatcher.leaveOut(e);
132136
}
133137
},

tests/intern.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ define({
2727
],
2828
functionalSuites: [
2929

30-
// See: https://github.com/jquery/PEP/issues/173
31-
// 'tests/functional/pointerevent_button_attribute_mouse-manual',
30+
'tests/functional/pointerevent_button_attribute_mouse-manual',
3231
'tests/functional/pointerevent_capture_mouse-manual',
3332
'tests/functional/pointerevent_capture_suppressing_mouse-manual',
3433

0 commit comments

Comments
 (0)