[Pkg-javascript-commits] [leaflet] 113/301: fix isArray not working IE9 in rare cases, close #2077

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit 361c9cab6d51ca91433e2d5358157cbf655add64
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date:   Tue Oct 8 16:59:38 2013 +0300

    fix isArray not working IE9 in rare cases, close #2077
---
 spec/suites/core/UtilSpec.js | 7 +++++++
 src/core/Util.js             | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/spec/suites/core/UtilSpec.js b/spec/suites/core/UtilSpec.js
index 0decc0f..f26befe 100644
--- a/spec/suites/core/UtilSpec.js
+++ b/spec/suites/core/UtilSpec.js
@@ -238,4 +238,11 @@ describe('Util', function() {
 			}).to.throwError();
 		});
 	});
+
+	describe('#isArray', function () {
+		expect(L.Util.isArray([1, 2, 3])).to.be.true;
+		expect(L.Util.isArray(new Array(1, 2, 3))).to.be.true;
+		expect(L.Util.isArray('blabla')).to.be.false;
+		expect(L.Util.isArray({0: 1, 1: 2})).to.be.false;
+	});
 });
diff --git a/src/core/Util.js b/src/core/Util.js
index e8fb78e..ca13965 100644
--- a/src/core/Util.js
+++ b/src/core/Util.js
@@ -120,7 +120,7 @@ L.Util = {
 		return cache[str](data);
 	},
 
-	isArray: function (obj) {
+	isArray: Array.isArray || function (obj) {
 		return (Object.prototype.toString.call(obj) === '[object Array]');
 	},
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list