Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* Improved `emulateTransitionEnd` utility, it will now separate `setTimeout` execution only where `supportTransitions` is `false` instead of executing it anyway.
  • Loading branch information
thednp committed Feb 4, 2019
1 parent ad245d1 commit 7b90dc3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions && one(element, transitionEndEvent, function(e){ handler(e); called = 1; });
setTimeout(function() { !called && handler(); }, duration + 17);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
},
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.

4 changes: 2 additions & 2 deletions dist/bootstrap-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions && one(element, transitionEndEvent, function(e){ handler(e); called = 1; });
setTimeout(function() { !called && handler(); }, duration + 17);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
},
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.

4 changes: 2 additions & 2 deletions lib/V3/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ var globalObject = typeof global !== 'undefined' ? global : this||window,
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions && one(element, transitionEndEvent, function(e){ handler(e); called = 1; });
setTimeout(function() { !called && handler(); }, duration + 17);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down
4 changes: 2 additions & 2 deletions lib/V4/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ var globalObject = typeof global !== 'undefined' ? global : this||window,
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
var called = 0, duration = getTransitionDurationFromElement(element);
supportTransitions && one(element, transitionEndEvent, function(e){ handler(e); called = 1; });
setTimeout(function() { !called && handler(); }, duration + 17);
supportTransitions ? one(element, transitionEndEvent, function(e){ !called && handler(e), called = 1; })
: setTimeout(function() { !called && handler(), called = 1; }, duration);
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
Expand Down

0 comments on commit 7b90dc3

Please sign in to comment.