Transition event fix

This commit is contained in:
Sam Potts
2018-01-19 14:22:26 +11:00
parent 5f96ec6ac2
commit 6831c30534
9 changed files with 13 additions and 13 deletions

4
src/js/controls.js vendored
View File

@ -845,11 +845,11 @@ const controls = {
container.style.height = '';
// Only listen once
utils.off(container, utils.transitionEnd, restore);
utils.off(container, utils.transitionEndEvent, restore);
};
// Listen for the transition finishing and restore auto height/width
utils.on(container, utils.transitionEnd, restore);
utils.on(container, utils.transitionEndEvent, restore);
// Set dimensions to target
container.style.width = `${size.width}px`;

View File

@ -151,7 +151,7 @@ const support = {
touch: 'ontouchstart' in document.documentElement,
// Detect transitions support
transitions: utils.transitionEnd !== false,
transitions: utils.transitionEndEvent !== false,
// Reduced motion iOS & MacOS setting
// https://webkit.org/blog/7551/responsive-design-for-motion/

View File

@ -728,7 +728,7 @@ const utils = {
},
// Get the transition end event
transitionEnd: (() => {
get transitionEndEvent() {
const element = document.createElement('span');
const events = {
@ -740,8 +740,8 @@ const utils = {
const type = Object.keys(events).find(event => element.style[event] !== undefined);
return typeof type === 'string' ? type : false;
})(),
return utils.is.string(type) ? events[type] : false;
},
// Force repaint of element
repaint(element) {