Skip to content

Instantly share code, notes, and snippets.

@pyronaur
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyronaur/966e9f379b7bf81257c5 to your computer and use it in GitHub Desktop.
Save pyronaur/966e9f379b7bf81257c5 to your computer and use it in GitHub Desktop.
Velocity.js CoffeeScript Love
var argumentIndex;
var syntacticSugar;
syntacticSugar = ( arguments[0].properties !== undefined );
/* Detect jQuery/Zepto elements. */
if (this.jquery || (window.Zepto && window.Zepto.zepto.isZ(this))) {
isWrapped = true;
elements = this;
argumentIndex = 0;
/* Otherwise, raw elements are being animated via the utility function. */
} else {
isWrapped = false;
if ( !syntacticSugar ) {
/* To guard from user errors, extract the raw DOM element(s) from the jQuery object if one was mistakenly passed in to the utility function. */
elements = arguments[0].jquery ? [].slice.call(arguments[0]) : arguments[0];
} else {
elements = arguments[0].elements;
}
argumentIndex = 1;
}
if( syntacticSugar ) {
propertiesMap = arguments[0].properties;
options = arguments[0].optionsl
} else {
propertiesMap = arguments[argumentIndex];
options = arguments[argumentIndex + 1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment