Skip to content

Commit

Permalink
Firefox Syntax Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
julianshapiro committed Jun 3, 2014
1 parent 241b0de commit 6d95175
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity",
"version": "0.0.18",
"version": "0.0.19",
"homepage": "http://velocityjs.org",
"authors": [
{ "name" : "Julian Shapiro",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "velocity",
"repository": "julianshapiro/velocity",
"version": "0.0.18",
"version": "0.0.19",
"description": "Accelerated JavaScript animation.",
"keywords": [
"animation",
Expand Down
34 changes: 18 additions & 16 deletions jquery.velocity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*!
* Velocity.js: Accelerated JavaScript animation.
* @version 0.0.18
* @version 0.0.19
* @docs http://velocityjs.org
* @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
*/
Expand Down Expand Up @@ -123,7 +123,7 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for

/* Determine if variable is a wrapped jQuery or Zepto element. */
function isWrapped (elements) {
return elements.jquery || (window.Zepto && window.Zepto.zepto.isZ(elements))
return elements && (elements.jquery || (window.Zepto && window.Zepto.zepto.isZ(elements)));
}

/******************
Expand Down Expand Up @@ -162,7 +162,7 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
which is later assigned to $.fn (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */
/* Note: The global object also doubles as a publicly-accessible data store for the purposes of unit testing. (Capitalized objects are meant for private use, lowercase objects are meant for public use.) */
/* Note: We alias both the lowercase and uppercase variants of "velocity" to minimize user issues due to the lowercase nature of the $.fn extension. */
var Velocity = global.Velocity = global.velocity = $.extend(global.Velocity || {}, {
var Velocity = global.Velocity = global.velocity = {
/* Container for page-wide Velocity state data. */
State: {
/* Detect mobile devices to determine if mobileHA should be turned on. */
Expand All @@ -186,7 +186,8 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
},
/* Velocity's custom CSS stack. Made global for unit testing. */
CSS: { /* Defined below. */ },
Utilities: { /* Defined by Velocity's optional jQuery shim. */ },
/* Defined by Velocity's optional jQuery shim. */
Utilities: window.jQuery ? {} : $,
/* Container for the user's custom animation sequences that are referenced by name via Velocity's first argument (in place of a properties map object). */
Sequences: {
/* Manually registered by the user. Learn more: VelocityJS.org/#sequences */
Expand All @@ -211,7 +212,7 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
animate: function () { /* Defined below. */ },
/* Set to 1 or 2 (most verbose) to output debug info to console. */
debug: false
});
};

/* Retrieve the appropriate scroll anchor and property name for the browser. Learn more: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */
if (window.pageYOffset !== undefined) {
Expand Down Expand Up @@ -1273,14 +1274,14 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
*************************/

/* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "properties" and "options" objects are defined on a container object that's passed in as Velocity's sole argument. */
var syntacticSugar = (arguments[0] && arguments[0].properties !== undefined),
var syntacticSugar = (arguments[0] && $.isPlainObject(arguments[0].properties)),
/* When Velocity is called via the utility function ($.Velocity.animate()/Velocity.animate()), elements are explicitly passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */
elementWrapped = isWrapped(this),
argumentIndex;

var elements,
propertiesMap,
options;
options;

/* Detect jQuery/Zepto elements being animated via the $.fn method. */
if (elementWrapped) {
Expand All @@ -1290,7 +1291,7 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
} else {
elements = syntacticSugar ? arguments[0].elements : arguments[0];
/* To guard from user errors, extract the raw DOM element(s) from the wrapped object if one was mistakenly passed into the utility function. */
elements = isWrapped(elements) ? [].slice.call(elements) : elements;
elements = isWrapped(elements) ? [].slice.call(elements) : elements;

argumentIndex = 1;
}
Expand Down Expand Up @@ -2669,7 +2670,6 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for

/* slideUp, slideDown */
$.each([ "Down", "Up" ], function(i, direction) {
/* Generate the slide sequences dynamically in order to minimize code redundancy. */
Velocity.Sequences["slide" + direction] = function (element, options) {
var opts = $.extend({}, options),
originalValues = {
Expand All @@ -2687,12 +2687,15 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
complete = opts.complete,
isHeightAuto = false;

/* Unless the user is trying to override the display option, show the element before slideDown begins and hide the element after slideUp completes. */
if (direction === "Down") {
/* All elements subjected to sliding down are set to the "block" display value (-- )as opposed to an element-appropriate block/inline distinction) because inline elements cannot actually have their dimensions modified. */
opts.display = opts.display || "block";
} else {
opts.display = opts.display || "none";
/* Allow the user to set display to null to bypass display toggling. */
if (opts.display !== null) {
/* Unless the user is trying to override the display option, show the element before slideDown begins and hide the element after slideUp completes. */
if (direction === "Down") {
/* All elements subjected to sliding down are set to the "block" display value (-- )as opposed to an element-appropriate block/inline distinction) because inline elements cannot actually have their dimensions modified. */
opts.display = opts.display || Velocity.CSS.Values.getDisplayType(element);
} else {
opts.display = opts.display || "none";
}
}

/* Begin callback. */
Expand Down Expand Up @@ -2789,7 +2792,6 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for

/* fadeIn, fadeOut */
$.each([ "In", "Out" ], function(i, direction) {
/* Generate the slide sequences dynamically in order to minimize code redundancy. */
Velocity.Sequences["fade" + direction] = function (element, options, elementsIndex, elementsSize) {
var opts = $.extend({}, options),
propertiesMap = {
Expand Down
4 changes: 2 additions & 2 deletions jquery.velocity.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity-animate",
"version": "0.0.18",
"version": "0.0.19",
"description": "Accelerated JavaScript animation.",
"keywords": [
"velocity",
Expand Down

0 comments on commit 6d95175

Please sign in to comment.