Skip to content

Commit

Permalink
Prevent errors in older jQuery versions.
Browse files Browse the repository at this point in the history
Closes #118.
  • Loading branch information
julianshapiro authored and Rycochet committed Aug 2, 2020
1 parent b0500c6 commit 42e76be
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/velocity/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "http://velocityjs.org",
"authors": [
{ "name" : "Julian Shapiro",
Expand Down
2 changes: 1 addition & 1 deletion packages/velocity/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "velocity",
"repository": "julianshapiro/velocity",
"version": "0.2.0",
"version": "0.2.1",
"description": "Accelerated JavaScript animation.",
"keywords": [
"animation",
Expand Down
9 changes: 6 additions & 3 deletions packages/velocity/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.2.0
* @version 0.2.1
* @docs http://velocityjs.org
* @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
*/
Expand Down Expand Up @@ -157,9 +157,12 @@ The biggest cause of both codebase bloat and codepath obfuscation is support for
}

/* Shorthand alias for jQuery's $.data() utility. */
var Data = function (element) {
function Data (element) {
/* Hardcode a reference to the plugin name. */
return $.data(element, NAME);
var response = $.data(element, NAME);

/* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */
return response === null ? undefined : response;
};

/*************
Expand Down
2 changes: 1 addition & 1 deletion packages/velocity/jquery.velocity.min.js

Large diffs are not rendered by default.

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

0 comments on commit 42e76be

Please sign in to comment.