From d1124c600b1bdedeec1f4a905eadbe34996d569c Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 23 Feb 2019 13:02:44 +0300 Subject: [PATCH] Update script.js 196 fix --- script.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index ac267213..dfdaac80 100644 --- a/script.js +++ b/script.js @@ -2455,8 +2455,10 @@ function fantasyMap() { } let group = this.value.toLowerCase().replace(/ /g, "_").replace(/[^\w\s]/gi, ""); if (Number.isFinite(+group.charAt(0))) group = "g" + group; - // if el with this id exists, add size to id - while (labels.selectAll("#"+group).size()) {group += "_new";} + if (d3.selectAll("#"+group).size()) { + tip("Element with this id already exists. Please provide a unique name"); + return; + } createNewLabelGroup(group); });