I'm using Dojo 1.9. It happens that the onSearch event runs twice instead of once in Safari and Chrome. In Firefox it runs OK.
SearchBox.onSearch = function(){
console.log("it ran");
}
I need it to run once. How can I manage to do that?
This jsfiddle reproduce this issue.
I think you are using the SearchBox in an unsupported case, that is without specifying its "store" property nor its "list" property.
I've put here: http://jsfiddle.net/adrian_vasiliu/g4yLQ/2/ a modified variant of your code. By setting the store property (here, to an empty dojo/store/Memory):
I get onSearch() called only once (tested in Chrome32/Win7). Since in practice SearchBox is supposed to be used with a store, I don't think this is really a bug.
Such uncanny behaviour seems like a Dojo bug, to me. You can always try a workaround, something like this: