Commit 4b7763dc authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Unbind all handlers in typeblock before binding new handler

Change-Id: I1cc72fa09f8e5b51c22b78e774a6c5b5d119f9f7
parent ca80ab80
...@@ -210,6 +210,7 @@ Blockly.TypeBlock.prototype.hide = function(){ ...@@ -210,6 +210,7 @@ Blockly.TypeBlock.prototype.hide = function(){
// if (this.typeBlockDiv_ == null) // if (this.typeBlockDiv_ == null)
// return; // return;
goog.style.showElement(goog.dom.getElement(this.typeBlockDiv_), false); goog.style.showElement(goog.dom.getElement(this.typeBlockDiv_), false);
goog.events.unlisten(this.docKh_, 'key', this.handleKeyWrapper_);
goog.events.unlisten(this.inputKh_, 'key', this.handleKeyWrapper_); goog.events.unlisten(this.inputKh_, 'key', this.handleKeyWrapper_);
this.handleKeyWrapper_ = this.handleKey.bind(this); this.handleKeyWrapper_ = this.handleKey.bind(this);
goog.events.listen(this.docKh_, 'key', this.handleKeyWrapper_); goog.events.listen(this.docKh_, 'key', this.handleKeyWrapper_);
...@@ -230,6 +231,7 @@ Blockly.TypeBlock.prototype.show = function(){ ...@@ -230,6 +231,7 @@ Blockly.TypeBlock.prototype.show = function(){
// correctly (at times it was missing the first char) // correctly (at times it was missing the first char)
goog.dom.getElement(this.inputText_).value = ''; goog.dom.getElement(this.inputText_).value = '';
goog.events.unlisten(this.docKh_, 'key', this.handleKeyWrapper_); goog.events.unlisten(this.docKh_, 'key', this.handleKeyWrapper_);
goog.events.unlisten(this.inputKh_, 'key', this.handleKeyWrapper_);
this.handleKeyWrapper_ = this.handleKey.bind(this); this.handleKeyWrapper_ = this.handleKey.bind(this);
goog.events.listen(this.inputKh_, 'key', this.handleKeyWrapper_); goog.events.listen(this.inputKh_, 'key', this.handleKeyWrapper_);
this.visible = true; this.visible = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment