Skip to content

Commit

Permalink
Change:
Browse files Browse the repository at this point in the history
* A more consistent way to better include `transitionDuration` into `emulateTransitionEnd` utility
  • Loading branch information
thednp committed Feb 4, 2019
1 parent 7b90dc3 commit 507c35d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@
var duration = supportTransitions ? globalObject[getComputedStyle](element)[transitionDuration] : 0;
duration = parseFloat(duration);
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0;
return duration + 17; // we take a short offset to make sure we fire on the next frame after animation
return duration; // we take a short offset to make sure we fire on the next frame after animation
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
duration ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, 17);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/bootstrap-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@
var duration = supportTransitions ? globalObject[getComputedStyle](element)[transitionDuration] : 0;
duration = parseFloat(duration);
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0;
return duration + 17; // we take a short offset to make sure we fire on the next frame after animation
return duration; // we take a short offset to make sure we fire on the next frame after animation
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
duration ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, 17);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-native.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/V3/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ var globalObject = typeof global !== 'undefined' ? global : this||window,
var duration = supportTransitions ? globalObject[getComputedStyle](element)[transitionDuration] : 0;
duration = parseFloat(duration);
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0;
return duration + 17; // we take a short offset to make sure we fire on the next frame after animation
return duration; // we take a short offset to make sure we fire on the next frame after animation
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
duration ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, 17);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down
6 changes: 3 additions & 3 deletions lib/V4/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ var globalObject = typeof global !== 'undefined' ? global : this||window,
var duration = supportTransitions ? globalObject[getComputedStyle](element)[transitionDuration] : 0;
duration = parseFloat(duration);
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0;
return duration + 17; // we take a short offset to make sure we fire on the next frame after animation
return duration; // we take a short offset to make sure we fire on the next frame after animation
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
duration ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, 17);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down

0 comments on commit 507c35d

Please sign in to comment.