From 7b33472203f1c44d46f6a689e94d84a908ed4636 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 8 Feb 2013 11:31:33 -0500 Subject: [PATCH] Nix the array joins --- js/id/svg.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/id/svg.js b/js/id/svg.js index 904a06eeb..bbd22fb78 100644 --- a/js/id/svg.js +++ b/js/id/svg.js @@ -7,7 +7,9 @@ iD.svg = { PointTransform: function(projection) { return function(entity) { - return 'translate(' + projection(entity.loc).join(',') + ')'; + // http://jsperf.com/short-array-join + var pt = projection(entity.loc); + return 'translate(' + pt[0] + ',' + pt[1] + ')'; }; }, @@ -24,7 +26,8 @@ iD.svg = { return (cache[entity.id] = 'M' + graph.childNodes(entity).map(function(n) { - return projection(n.loc); + var pt = projection(n.loc); + return pt[0] + ',' + pt[1]; }).join('L')); }; },