Files
iD/js/lib/d3.one.js
John Firebaugh d9630a8820 Only do the delete hack if it's the first key press
This avoids unexpectedly deleting when you spam backspace
to clear a failed search query.
2013-03-05 10:10:28 -08:00

10 lines
278 B
JavaScript

d3.selection.prototype.one = function (type, listener, capture) {
var target = this, typeOnce = type + ".once";
function one() {
target.on(typeOnce, null);
listener.apply(this, arguments);
}
target.on(typeOnce, one, capture);
return this;
};