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

Commit 47409b8

Browse files
committed
Merge pull request #105 from azakus/web-platform-tests
A few spec compliance changes to pass the w3c tests
2 parents ea4bec9 + 8dc9be8 commit 47409b8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/PointerEvent.js

+6
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
);
118118
}
119119

120+
// make the event pass instanceof checks
121+
e.__proto__ = PointerEvent.prototype;
122+
120123
// define the buttons property according to DOM Level 3 spec
121124
if (!HAS_BUTTONS) {
122125
// IE 10 has buttons on MouseEvent.prototype as a getter w/o any setting
@@ -148,6 +151,9 @@
148151
return e;
149152
}
150153

154+
// PointerEvent extends MouseEvent
155+
PointerEvent.prototype = Object.create(MouseEvent.prototype);
156+
151157
// attach to window
152158
if (!scope.PointerEvent) {
153159
scope.PointerEvent = PointerEvent;

src/dispatcher.js

+4
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@
215215
* @return {Event} A PointerEvent of type `inType`
216216
*/
217217
makeEvent: function(inType, inEvent) {
218+
// relatedTarget must be null if pointer is captured
219+
if (this.captureInfo) {
220+
inEvent.relatedTarget = null;
221+
}
218222
var e = new PointerEvent(inType, inEvent);
219223
this.targets.set(e, this.targets.get(inEvent) || inEvent.target);
220224
return e;

0 commit comments

Comments
 (0)