Skip to content

Commit

Permalink
Allow Velocity(document.querySelector("div"), ...) and similar calls …
Browse files Browse the repository at this point in the history
…(not specific checking for jQuery / Zepto wrapped)

Closes #714
  • Loading branch information
Rycochet committed Nov 3, 2016
1 parent 527eef4 commit 04e6c35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions velocity.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@
}

var Type = {
isNumber: function(variable) {
return (typeof variable === "number");
},
isString: function(variable) {
return (typeof variable === "string");
},
Expand All @@ -544,9 +547,9 @@
variable.length !== undefined &&
(variable.length === 0 || (typeof variable[0] === "object" && variable[0].nodeType > 0));
},
/* Determine if variable is a wrapped jQuery or Zepto element. */
/* Determine if variable is an array-like wrapped jQuery, Zepto or similar element. */
isWrapped: function(variable) {
return variable && (variable.jquery || (window.Zepto && window.Zepto.zepto.isZ(variable)));
return variable && (Type.isArray(variable) || (Type.isNumber(variable.length) && !Type.isString(variable) && !Type.isFunction(variable)));
},
isSVG: function(variable) {
return window.SVGElement && (variable instanceof window.SVGElement);
Expand Down
Loading

0 comments on commit 04e6c35

Please sign in to comment.