From a57cdbd5b5f4efa94ecc61498fdb4039276f86f0 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 23 Oct 2017 20:10:05 +0900 Subject: dom helper --- src/content/components/common/input.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/content/components/common/input.js') diff --git a/src/content/components/common/input.js b/src/content/components/common/input.js index f285b0c..ef5af29 100644 --- a/src/content/components/common/input.js +++ b/src/content/components/common/input.js @@ -1,3 +1,5 @@ +import * as dom from 'shared/utils/dom'; + const modifierdKeyName = (name) => { if (name.length === 1) { return name.toUpperCase(); @@ -78,12 +80,12 @@ export default class InputComponent { } fromInput(e) { + if (!e.target) { + return false; + } return e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement || - e.target instanceof HTMLElement && - e.target.hasAttribute('contenteditable') && ( - e.target.getAttribute('contenteditable').toLowerCase() === 'true' || - e.target.getAttribute('contenteditable').toLowerCase() === ''); + dom.isContentEditable(e.target); } } -- cgit v1.2.3