Use native isFinite method to detect NaN and Infinities
parent
d487c73ce8
commit
013c92fc0f
|
@ -71,7 +71,6 @@ var has = "hasOwnProperty",
|
|||
objectToString = Object.prototype.toString,
|
||||
ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
|
||||
colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,
|
||||
isnan = {"NaN": 1, "Infinity": 1, "-Infinity": 1},
|
||||
bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
|
||||
reURLValue = /^url\(#?([^)]+)\)$/,
|
||||
spaces = "\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029",
|
||||
|
@ -139,7 +138,7 @@ function getAttrs(el) {
|
|||
function is(o, type) {
|
||||
type = Str.prototype.toLowerCase.call(type);
|
||||
if (type == "finite") {
|
||||
return !isnan[has](+o);
|
||||
return isFinite(o);
|
||||
}
|
||||
if (type == "array" &&
|
||||
(o instanceof Array || Array.isArray && Array.isArray(o))) {
|
||||
|
|
Loading…
Reference in New Issue