diff options
author | louisremi <louisremi@louisremi-laptop.(none)> | 2011-04-11 19:01:04 +0200 |
---|---|---|
committer | louisremi <louisremi@louisremi-laptop.(none)> | 2011-04-11 19:01:04 +0200 |
commit | 780b7983d0a2fbde5cedcdb431a1f2436b256d40 (patch) | |
tree | 5de5313210ddae4286c529ab978360f14ed29083 /src/effects.js | |
parent | 56ffad2dad138293c132e6ad353111bd2d1f1239 (diff) | |
download | jquery-780b7983d0a2fbde5cedcdb431a1f2436b256d40.tar.gz jquery-780b7983d0a2fbde5cedcdb431a1f2436b256d40.zip |
Group all local functions at the top of the file and add comments
Diffstat (limited to 'src/effects.js')
-rw-r--r-- | src/effects.js | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/effects.js b/src/effects.js index f334ac95b..80c033abc 100644 --- a/src/effects.js +++ b/src/effects.js @@ -17,13 +17,44 @@ var elemdisplay = {}, window.mozRequestAnimationFrame || window.oRequestAnimationFrame; +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout( clearFxNow, 0 ); + return ( fxNow = jQuery.now() ); +} + function clearFxNow() { fxNow = undefined; } -function createFxNow() { - setTimeout( clearFxNow, 0 ); - return ( fxNow = jQuery.now() ); +// Try to restore the default display value of an element +// fails if a display rule has been set for this element, e.g. div { display: inline; } +function defaultDisplay( nodeName ) { + if ( !elemdisplay[ nodeName ] ) { + var elem = jQuery("<" + nodeName + ">").appendTo("body"), + display = elem.css("display"); + + elem.remove(); + + if ( display === "none" || display === "" ) { + display = "block"; + } + + elemdisplay[ nodeName ] = display; + } + + return elemdisplay[ nodeName ]; +} + +// Generate parameters to create a standard animation +function genFx( type, num ) { + var obj = {}; + + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { + obj[ this ] = type; + }); + + return obj; } jQuery.fn.extend({ @@ -260,16 +291,6 @@ jQuery.fn.extend({ }); -function genFx( type, num ) { - var obj = {}; - - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { - obj[ this ] = type; - }); - - return obj; -} - // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show", 1), @@ -536,21 +557,4 @@ if ( jQuery.expr && jQuery.expr.filters ) { }; } -function defaultDisplay( nodeName ) { - if ( !elemdisplay[ nodeName ] ) { - var elem = jQuery("<" + nodeName + ">").appendTo("body"), - display = elem.css("display"); - - elem.remove(); - - if ( display === "none" || display === "" ) { - display = "block"; - } - - elemdisplay[ nodeName ] = display; - } - - return elemdisplay[ nodeName ]; -} - })( jQuery ); |