Comparing version 0.2.3 to 0.2.4
@@ -0,1 +1,8 @@ | ||
# 0.2.3 | ||
> 2017-06-26 | ||
- Added `WheelHandler` | ||
- Added `translateDOMPositionXY` | ||
# 0.2.1 | ||
@@ -14,2 +21,3 @@ | ||
# 0.1.1 | ||
> 2017-03-31 | ||
@@ -16,0 +24,0 @@ |
@@ -52,3 +52,3 @@ 'use strict'; | ||
if ((pX || pY) && event.deltaMode) { | ||
if (event.deltaMode == 1) { | ||
if (event.deltaMode === 1) { | ||
// delta in LINE units | ||
@@ -55,0 +55,0 @@ pX *= LINE_HEIGHT; |
@@ -18,42 +18,71 @@ 'use strict'; | ||
var prefix = void 0, | ||
transitionEnd = void 0; | ||
if (_query.canUseDOM) { | ||
transition = getTransitionProperties(); | ||
transform = transition.prefix + transform; | ||
var _getTransitionPropert = getTransitionProperties(); | ||
transitionProperty = transition.prefix + 'transition-property'; | ||
transitionDuration = transition.prefix + 'transition-duration'; | ||
transitionDelay = transition.prefix + 'transition-delay'; | ||
transitionTiming = transition.prefix + 'transition-timing-function'; | ||
backfaceVisibility = transition.prefix + 'backface-visibility'; | ||
prefix = _getTransitionPropert.prefix; | ||
transitionEnd = _getTransitionPropert.transitionEnd; | ||
transform = prefix + '-' + transform; | ||
transitionProperty = prefix + '-transition-property'; | ||
transitionDuration = prefix + '-transition-duration'; | ||
transitionDelay = prefix + '-transition-delay'; | ||
transitionTiming = prefix + '-transition-timing-function'; | ||
backfaceVisibility = prefix + '-backface-visibility'; | ||
} | ||
function getTransitionProperties() { | ||
var endEvent = void 0, | ||
prefix = '', | ||
transitions = { | ||
O: 'otransitionend', | ||
Moz: 'transitionend', | ||
Webkit: 'webkitTransitionEnd', | ||
ms: 'MSTransitionEnd' | ||
var style = document.createElement('div').style; | ||
var vendorMap = { | ||
O: function O(e) { | ||
return 'o' + e.toLowerCase(); | ||
}, | ||
Moz: function Moz(e) { | ||
return e.toLowerCase(); | ||
}, | ||
Webkit: function Webkit(e) { | ||
return 'webkit' + e; | ||
}, | ||
ms: function ms(e) { | ||
return 'MS' + e; | ||
} | ||
}; | ||
var element = document.createElement('div'); | ||
var vendors = Object.keys(vendorMap); | ||
var transitionEnd = void 0, | ||
animationEnd = void 0; | ||
var prefix = ''; | ||
for (var vendor in transitions) { | ||
if (has.call(transitions, vendor)) { | ||
if (element.style[vendor + 'TransitionProperty'] !== undefined) { | ||
prefix = '-' + vendor.toLowerCase() + '-'; | ||
endEvent = transitions[vendor]; | ||
break; | ||
} | ||
for (var i = 0; i < vendors.length; i++) { | ||
var vendor = vendors[i]; | ||
if (vendor + 'TransitionProperty' in style) { | ||
prefix = '-' + vendor.toLowerCase(); | ||
console.log(prefix); | ||
transitionEnd = vendorMap[vendor]('TransitionEnd'); | ||
animationEnd = vendorMap[vendor]('AnimationEnd'); | ||
break; | ||
} | ||
} | ||
if (!endEvent && element.style.transitionProperty !== undefined) { | ||
endEvent = 'transitionend'; | ||
if (!transitionEnd && 'transitionProperty' in style) { | ||
transitionEnd = 'transitionend'; | ||
} | ||
if (!animationEnd && 'animationName' in style) { | ||
animationEnd = 'animationend'; | ||
} | ||
style = null; | ||
return { | ||
end: endEvent, | ||
animationEnd: animationEnd, | ||
transitionEnd: transitionEnd, | ||
prefix: prefix | ||
@@ -66,3 +95,3 @@ }; | ||
transform: transform, | ||
end: transition.end, | ||
end: transitionEnd, | ||
property: transitionProperty, | ||
@@ -69,0 +98,0 @@ timing: transitionTiming, |
@@ -11,6 +11,2 @@ 'use strict'; | ||
var _camelize = require('../utils/camelize'); | ||
var _camelize2 = _interopRequireDefault(_camelize); | ||
var _BrowserSupportCore = require('../BrowserSupportCore'); | ||
@@ -20,6 +16,10 @@ | ||
var _getVendorPrefixedName = require('../getVendorPrefixedName'); | ||
var _getVendorPrefixedName2 = _interopRequireDefault(_getVendorPrefixedName); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var TRANSFORM = (0, _camelize2.default)(_index2.default.transform); | ||
var BACKFACE_VISIBILITY = (0, _camelize2.default)(_index2.default.backfaceVisibility); | ||
var TRANSFORM = (0, _getVendorPrefixedName2.default)('transform'); | ||
var BACKFACE_VISIBILITY = (0, _getVendorPrefixedName2.default)('backfaceVisibility'); | ||
@@ -36,3 +36,6 @@ var translateDOMPositionXY = function () { | ||
if (!isSafari && _BrowserSupportCore2.default.hasCSS3DTransforms()) { | ||
return function (style, x, y) { | ||
return function (style) { | ||
var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
style[TRANSFORM] = 'translate3d(' + x + 'px,' + y + 'px,0)'; | ||
@@ -42,3 +45,6 @@ style[BACKFACE_VISIBILITY] = 'hidden'; | ||
} else { | ||
return function (style, x, y) { | ||
return function (style) { | ||
var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
style[TRANSFORM] = 'translate(' + x + 'px,' + y + 'px)'; | ||
@@ -45,0 +51,0 @@ }; |
{ | ||
"name": "dom-lib", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "DOM helper library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
64786
1610