dom-autoscroller
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -1,6 +0,63 @@ | ||
var autoScroll = (function (createPointCB) { | ||
var autoScroll = (function () { | ||
'use strict'; | ||
createPointCB = 'default' in createPointCB ? createPointCB['default'] : createPointCB; | ||
var index = function createPointCB(object) { | ||
// A persistent object (as opposed to returned object) is used to save memory | ||
// This is good to prevent layout thrashing, or for games, and such | ||
// NOTE | ||
// This uses IE fixes which should be OK to remove some day. :) | ||
// Some speed will be gained by removal of these. | ||
// pointCB should be saved in a variable on return | ||
// This allows the usage of element.removeEventListener | ||
return function pointCB(event) { | ||
event = event || window.event; // IE-ism | ||
object.target = event.target || event.srcElement || event.originalTarget; | ||
object.element = this; | ||
object.type = event.type; | ||
// Support touch | ||
// http://www.creativebloq.com/javascript/make-your-site-work-touch-devices-51411644 | ||
if (event.targetTouches) { | ||
object.x = event.targetTouches[0].clientX; | ||
object.y = event.targetTouches[0].clientY; | ||
object.pageX = event.pageX; | ||
object.pageY = event.pageY; | ||
} else { | ||
// If pageX/Y aren't available and clientX/Y are, | ||
// calculate pageX/Y - logic taken from jQuery. | ||
// (This is to support old IE) | ||
// NOTE Hopefully this can be removed soon. | ||
if (event.pageX === null && event.clientX !== null) { | ||
var eventDoc = event.target && event.target.ownerDocument || document; | ||
var doc = eventDoc.documentElement; | ||
var body = eventDoc.body; | ||
object.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
object.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | ||
} else { | ||
object.pageX = event.pageX; | ||
object.pageY = event.pageY; | ||
} | ||
// pageX, and pageY change with page scroll | ||
// so we're not going to use those for x, and y. | ||
// NOTE Most browsers also alias clientX/Y with x/y | ||
// so that's something to consider down the road. | ||
object.x = event.clientX; | ||
object.y = event.clientY; | ||
} | ||
}; | ||
//NOTE Remember accessibility, Aria roles, and labels. | ||
}; | ||
var requestFrame = function () { | ||
@@ -35,3 +92,3 @@ if (requestAnimationFrame) { | ||
var point = {}, | ||
pointCB = createPointCB(point), | ||
pointCB = index(point), | ||
down = false; | ||
@@ -326,3 +383,3 @@ | ||
}(createPointCB)); | ||
}()); | ||
//# sourceMappingURL=dom-autoscroller.js.map |
{ | ||
"name": "dom-autoscroller", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Auto scroll dom elements", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
89085
838
0