Skip to content

Commit

Permalink
🐞 Fix iOS transition bug
Browse files Browse the repository at this point in the history
+ wasn't property caching vendor properties
+ remove proto._transition, unnecessary post IE10+

Thx https://twitter.com/krielkipnl/status/694504623344869376
  • Loading branch information
desandro committed Feb 2, 2016
1 parent 261077f commit aaa7867
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions item.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ var transitionEndEvent = {
transition: 'transitionend'
}[ transitionProperty ];

// cache all vendor properties
var vendorProperties = [
transformProperty,
transitionProperty,
transitionProperty + 'Duration',
transitionProperty + 'Property'
];
// cache all vendor properties that could have vendor prefix
var vendorProperties = {
transform: transformProperty,
transition: transitionProperty,
transitionDuration: transitionProperty + 'Duration',
transitionProperty: transitionProperty + 'Property'
};

// -------------------------- Item -------------------------- //

Expand Down Expand Up @@ -276,7 +276,7 @@ proto._nonTransition = function( args ) {
* @param {Boolean} isCleaning - removes transition styles after transition
* @param {Function} onTransitionEnd - callback
*/
proto._transition = function( args ) {
proto.transition = function( args ) {
// redirect to nonTransition if no transition duration
if ( !parseFloat( this.layout.options.transitionDuration ) ) {
this._nonTransition( args );
Expand Down Expand Up @@ -322,8 +322,7 @@ function toDashedAll( str ) {
});
}

var transitionProps = 'opacity,' +
toDashedAll( vendorProperties.transform || 'transform' );
var transitionProps = 'opacity,' + toDashedAll( transformProperty );

proto.enableTransition = function(/* style */) {
// HACK changing transitionProperty during a transition
Expand All @@ -350,8 +349,6 @@ proto.enableTransition = function(/* style */) {
this.element.addEventListener( transitionEndEvent, this, false );
};

proto.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ];

// ----- events ----- //

proto.onwebkitTransitionEnd = function( event ) {
Expand Down

0 comments on commit aaa7867

Please sign in to comment.