From 013c92fc0f19c2906e8b3ce19af29f03d3b613d0 Mon Sep 17 00:00:00 2001 From: Anton Khlynovskiy Date: Fri, 25 Oct 2013 17:24:59 +0400 Subject: [PATCH] Use native isFinite method to detect NaN and Infinities --- src/svg.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/svg.js b/src/svg.js index 626bfcf..faec271 100644 --- a/src/svg.js +++ b/src/svg.js @@ -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))) {