Skip to content

Commit

Permalink
Remove IE10 support.
Browse files Browse the repository at this point in the history
IE10 reached EOL a long time ago.

Also, the usage of the features plugin:

./handlers/features!mspointer-events?...

made loading the code via WebPack etc. problematic.
  • Loading branch information
wkeese committed Feb 22, 2019
1 parent 56b8db1 commit 6e93bcf
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 37 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This API is a shim of the [W3C Pointer Events specification][W3C_pointer] and ad

##Supported environments
The API has been successfully tested on the following environments.

###Mobile

- Android 4.1.2+ (Stock browser and Chrome)
Expand All @@ -20,11 +21,15 @@ The API has been successfully tested on the following environments.
- WindowsPhone 8.x

###Desktop

- Chrome (mouse)
- FireFox (mouse + touchscreen)
- IE10+ (mouse + touchscreen)
- IE11 (mouse + touchscreen)
- Edge (mouse)
- Safari (mouse)

## Dependencies

This project can be integrated into any AMD capable javascript application.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dpointer",
"version": "0.5.1",
"version": "0.5.2",
"dependencies": {
"requirejs-dplugins": "0.6.x"
},
Expand Down
42 changes: 12 additions & 30 deletions events.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ define([
"./handlers/features",
"./handlers/utils",
"./handlers/touch",
"./handlers/mouse",
"./handlers/features!mspointer-events?./handlers/mspointer"
], function (has, utils, touch, mouse, mspointer) {
"./handlers/mouse"
], function (has, utils, touch, mouse) {
"use strict";

var pointerEvents = {_targetElement: null};
Expand All @@ -25,14 +24,10 @@ define([
return;// already initialized
}
if (!has("pointer-events")) {
if (has("mspointer-events")) {
mspointer.registerHandlers(targetElement);
if (has("touch-events") && has("touch-device")) {
touch.registerHandlers(targetElement);
} else {
if (has("touch-events") && has("touch-device")) {
touch.registerHandlers(targetElement);
} else {
mouse.registerHandlers(targetElement);
}
mouse.registerHandlers(targetElement);
}
}
this._targetElement = targetElement;
Expand All @@ -45,7 +40,6 @@ define([
if (this._targetElement) {
touch.deregisterHandlers(this._targetElement);
mouse.deregisterHandlers(this._targetElement);
mspointer && mspointer.deregisterHandlers(this._targetElement);
}
this._targetElement = null;
};
Expand Down Expand Up @@ -77,14 +71,10 @@ define([
if (has("pointer-events")) {
return targetElement.setPointerCapture(pointerId);// use native Pointer Events method
} else {
if (has("mspointer-events")) {
return targetElement.msSetPointerCapture(pointerId);// use native Pointer Events method
if (pointerId === 1) { // mouse always gets ID = 1
return mouse.setPointerCapture(targetElement);
} else {
if (pointerId === 1) { // mouse always gets ID = 1
return mouse.setPointerCapture(targetElement);
} else {
return touch.setPointerCapture(targetElement, pointerId);
}
return touch.setPointerCapture(targetElement, pointerId);
}
}
};
Expand All @@ -102,14 +92,10 @@ define([
if (has("pointer-events")) {
return targetElement.releasePointerCapture(pointerId);
} else {
if (has("mspointer-events")) {
return targetElement.msReleasePointerCapture(pointerId);
if (pointerId === 1) {
return mouse.releasePointerCapture(targetElement);
} else {
if (pointerId === 1) {
return mouse.releasePointerCapture(targetElement);
} else {
return touch.releasePointerCapture(targetElement, pointerId);
}
return touch.releasePointerCapture(targetElement, pointerId);
}
}
};
Expand All @@ -136,10 +122,6 @@ define([
insertTouchActionCSSRule("touch-action");
}

// CSS rule for IE10 and IE11 preview
if (has("mspointer-events")) {
insertTouchActionCSSRule("-ms-touch-action");
}
// CSS rule to map CSS attribute in case user agent has native support for touch-action or -ms-touch-action
// CSS property.
if (has("css-touch-action")) {
Expand All @@ -155,4 +137,4 @@ define([
pointerEvents.enable();

return pointerEvents;
});
});
3 changes: 1 addition & 2 deletions handlers/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ define([
if (typeof document !== "undefined") {
has.add("touch-events", "ontouchstart" in document); // UA supports Touch Events
has.add("pointer-events", "onpointerdown" in document); // UA supports Pointer Events
has.add("mspointer-events", "onmspointerdown" in document); // UA supports Pointer Events (IE10+IE11 preview)
has.add("touch-device", /(mobile)|(android)/i.test(navigator.userAgent)); // mobile device
has.add("css-touch-action", "touchAction" in document.body.style);// touch-action CSS
has.add("css-ms-touch-action", "msTouchAction" in document.body.style);// -ms-touch-action CSS
}
return has;
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dpointer",
"version": "0.5.1",
"version": "0.5.2",
"devDependencies": {
"intern": "1.6.x",
"grunt": "~0.4.2",
Expand Down
2 changes: 1 addition & 1 deletion tests/intern/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ define({
reporters: ["console"],

excludeInstrumentation: /^(requirejs.*|dpointer\/tests)/
});
});
2 changes: 1 addition & 1 deletion tests/intern/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ define([
config.maxConcurrency = 1;

return config;
});
});

0 comments on commit 6e93bcf

Please sign in to comment.