From a3d241196714dc68e9b0ec9f3ac79e7d25c5344e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 25 Mar 2013 10:41:07 -0700 Subject: [PATCH] Reuse input variable --- js/lib/d3.combobox.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/lib/d3.combobox.js b/js/lib/d3.combobox.js index f237c181e..44686cdfd 100644 --- a/js/lib/d3.combobox.js +++ b/js/lib/d3.combobox.js @@ -14,9 +14,11 @@ d3.combobox = function() { var typeahead = function(selection) { var idx = -1; - input = selection.select('input').classed('combobox-input', true); - selection.append('div', selection.select('input')) + input = selection.select('input') + .classed('combobox-input', true); + + selection.append('div', input) .attr('class', 'combobox-carat') .on('mousedown', stop) .on('mousedown', function() { @@ -25,9 +27,7 @@ d3.combobox = function() { }); function updateSize() { - var rect = selection.select('input') - .node() - .getBoundingClientRect(); + var rect = input.node().getBoundingClientRect(); container.style({ 'left': rect.left + 'px', 'width': rect.width + 'px',