From 6bc1881727ea3b44436495f05c9033528057aa76 Mon Sep 17 00:00:00 2001 From: TDaglis Date: Tue, 7 Jun 2016 13:58:00 +0300 Subject: [PATCH] Fix emission of terminal focus&blur events --- src/xterm.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index a0d4fd09..9f9b85ae 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -401,7 +401,6 @@ this.showCursor(); this.element.focus(); - this.emit('focus', {terminal: this}); }; Terminal.prototype.blur = function() { @@ -417,7 +416,6 @@ this.send('\x1b[O'); } Terminal.focus = null; - this.emit('blur', {terminal: this}); }; /** @@ -627,6 +625,12 @@ this.element.classList.add('xterm-theme-' + this.theme); this.element.setAttribute('tabindex', 0); this.element.spellcheck = 'false'; + this.element.onfocus = function() { + self.emit('focus', {terminal: this}); + }; + this.element.onblur = function() { + self.emit('blur', {terminal: this}); + }; /* * Create the container that will hold the lines of the terminal and then