Browse Source

Transition no longer determines vendor prefixes for animation-name prop. Removed 2 unnecessary prop lookups from animation increasing performance

pull/2209/head
jlukic 10 years ago
parent
commit
10a88ebef4
1 changed files with 8 additions and 26 deletions
  1. 34
      src/definitions/modules/transition.js

34
src/definitions/modules/transition.js

@ -47,7 +47,6 @@ $.fn.transition = function() {
error, error,
className, className,
metadata, metadata,
animationStart,
animationEnd, animationEnd,
animationName, animationName,
@ -76,8 +75,6 @@ $.fn.transition = function() {
// get vendor specific events // get vendor specific events
animationEnd = module.get.animationEndEvent(); animationEnd = module.get.animationEndEvent();
animationName = module.get.animationName();
animationStart = module.get.animationStartEvent();
if(methodInvoked) { if(methodInvoked) {
methodInvoked = module.invoke(query); methodInvoked = module.invoke(query);
@ -577,24 +574,6 @@ $.fn.transition = function() {
transitionExists: function(animation) { transitionExists: function(animation) {
return $.fn.transition.exists[animation]; return $.fn.transition.exists[animation];
}, },
animationName: function() {
var
element = document.createElement('div'),
animations = {
'animation' :'animationName',
'OAnimation' :'oAnimationName',
'MozAnimation' :'mozAnimationName',
'WebkitAnimation' :'webkitAnimationName'
},
animation
;
for(animation in animations){
if( element.style[animation] !== undefined ){
return animations[animation];
}
}
return false;
},
animationStartEvent: function() { animationStartEvent: function() {
var var
element = document.createElement('div'), element = document.createElement('div'),
@ -637,10 +616,10 @@ $.fn.transition = function() {
can: { can: {
transition: function(forced) { transition: function(forced) {
var var
elementClass = $module.attr('class'),
tagName = $module.prop('tagName'),
animation = settings.animation, animation = settings.animation,
transitionExists = module.get.transitionExists(animation), transitionExists = module.get.transitionExists(animation),
elementClass,
tagName,
$clone, $clone,
currentAnimation, currentAnimation,
inAnimation, inAnimation,
@ -649,6 +628,9 @@ $.fn.transition = function() {
; ;
if( transitionExists === undefined || forced) { if( transitionExists === undefined || forced) {
module.verbose('Determining whether animation exists'); module.verbose('Determining whether animation exists');
elementClass = $module.attr('class');
tagName = $module.prop('tagName');
$clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module); $clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
currentAnimation = $clone currentAnimation = $clone
.addClass(animation) .addClass(animation)
@ -656,11 +638,11 @@ $.fn.transition = function() {
.removeClass(className.outward) .removeClass(className.outward)
.addClass(className.animating) .addClass(className.animating)
.addClass(className.transition) .addClass(className.transition)
.css(animationName)
.css('animationName')
; ;
inAnimation = $clone inAnimation = $clone
.addClass(className.inward) .addClass(className.inward)
.css(animationName)
.css('animationName')
; ;
displayType = $clone displayType = $clone
.attr('class', elementClass) .attr('class', elementClass)
@ -724,7 +706,7 @@ $.fn.transition = function() {
return $module.css('visibility') === 'hidden'; return $module.css('visibility') === 'hidden';
}, },
supported: function() { supported: function() {
return(animationName !== false && animationEnd !== false);
return(animationEnd !== false);
} }
}, },

Loading…
Cancel
Save