From 0df2801cdc431d9488fbed5c476ada10ec6ca8a9 Mon Sep 17 00:00:00 2001 From: Viliam Krizan Date: Tue, 17 Jun 2014 14:18:39 +0200 Subject: [PATCH 1/2] Fixed unknown region select --- tests/unknown-region.html | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/unknown-region.html diff --git a/tests/unknown-region.html b/tests/unknown-region.html new file mode 100644 index 00000000..627bfac3 --- /dev/null +++ b/tests/unknown-region.html @@ -0,0 +1,61 @@ + + + + + Maps + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Selected: United States (US), Cocos Islands (CC), Australia (AU)
+ Non existent region: Cocos Islands (CC) +

+ +
+ + \ No newline at end of file From e8613e0669fd24a96bdc81f00752c491e0baecac Mon Sep 17 00:00:00 2001 From: Viliam Krizan Date: Tue, 17 Jun 2014 14:21:55 +0200 Subject: [PATCH 2/2] Fixed unknown region select --- src/map.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map.js b/src/map.js index bf592a6d..d2750b26 100644 --- a/src/map.js +++ b/src/map.js @@ -631,11 +631,15 @@ jvm.Map.prototype = { if (jvm.$.isArray(keys)) { for (i = 0; i < keys.length; i++) { - this[type][keys[i]].element.setSelected(true); + if (this[type][keys[i]] != undefined) { + this[type][keys[i]].element.setSelected(true); + } } } else { for (i in keys) { - this[type][i].element.setSelected(!!keys[i]); + if (this[type][i] != undefined) { + this[type][i].element.setSelected(!!keys[i]); + } } } },