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

Commit

Permalink
Merge pull request #106 from scottgonzalez/old-ie-support
Browse files Browse the repository at this point in the history
Old IE support
  • Loading branch information
dfreedm committed Nov 1, 2013
2 parents c1d7830 + adfbfd5 commit 8efd3a8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

(function(scope) {
scope = scope || {};
scope.external = scope.external || {};
var target = {
shadow: function(inEl) {
if (inEl) {
Expand Down
2 changes: 1 addition & 1 deletion src/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
dispatcher.releaseCapture(pointerId, this);
};
}
if (!Element.prototype.setPointerCapture) {
if (window.Element && !Element.prototype.setPointerCapture) {
Object.defineProperties(Element.prototype, {
'setPointerCapture': {
value: s
Expand Down
13 changes: 8 additions & 5 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@
es.unregister.call(es, element);
}
},
contains: scope.external.contains || function(container, contained) {
return container.contains(contained);
},
// EVENTS
down: function(inEvent) {
this.fireEvent('pointerdown', inEvent);
Expand Down Expand Up @@ -161,13 +164,13 @@
this.fireEvent('pointercancel', inEvent);
},
leaveOut: function(event) {
if (!event.target.contains(event.relatedTarget)) {
if (!this.contains(event.target, event.relatedTarget)) {
this.leave(event);
}
this.out(event);
},
enterOver: function(event) {
if (!event.target.contains(event.relatedTarget)) {
if (!this.contains(event.target, event.relatedTarget)) {
this.enter(event);
}
this.over(event);
Expand Down Expand Up @@ -199,10 +202,10 @@
this.removeEvent(target, e);
}, this);
},
addEvent: function(target, eventName) {
addEvent: scope.external.addEvent || function(target, eventName) {
target.addEventListener(eventName, this.boundHandler);
},
removeEvent: function(target, eventName) {
removeEvent: scope.external.removeEvent || function(target, eventName) {
target.removeEventListener(eventName, this.boundHandler);
},
// EVENT CREATION AND TRACKING
Expand Down Expand Up @@ -282,7 +285,7 @@
* @param {Event} inEvent The event to be dispatched.
* @return {Boolean} True if an event handler returns true, false otherwise.
*/
dispatchEvent: function(inEvent) {
dispatchEvent: scope.external.dispatchEvent || function(inEvent) {
var t = this.getTarget(inEvent);
if (t) {
return t.dispatchEvent(inEvent);
Expand Down
2 changes: 1 addition & 1 deletion src/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
this.cleanupMouse();
},
cleanupMouse: function() {
pointermap.delete(this.POINTER_ID);
pointermap['delete'](this.POINTER_ID);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/ms.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
return e;
},
cleanup: function(id) {
pointermap.delete(id);
pointermap['delete'](id);
},
MSPointerDown: function(inEvent) {
pointermap.set(inEvent.pointerId, inEvent);
Expand Down
6 changes: 3 additions & 3 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
}
},
elementRemoved: function(el) {
this.scrollType.delete(el);
this.scrollType['delete'](el);
dispatcher.unlisten(el, this.events);
// remove touch-action from shadow
allShadows(el).forEach(function(s) {
this.scrollType.delete(s);
this.scrollType['delete'](s);
dispatcher.unlisten(s, this.events);
}, this);
},
Expand Down Expand Up @@ -291,7 +291,7 @@
this.cleanUpPointer(inPointer);
},
cleanUpPointer: function(inPointer) {
pointermap.delete(inPointer.pointerId);
pointermap['delete'](inPointer.pointerId);
this.removePrimaryPointer(inPointer);
},
// prevent synth mouse events from creating pointer events
Expand Down

0 comments on commit 8efd3a8

Please sign in to comment.