diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-21 22:19:01 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-21 22:19:01 +0900 |
commit | a052ec92b7c7f27447211222231f43f07c2990c8 (patch) | |
tree | 8cb109444a10f9acfe2d3a999b1adb7a88f24abe /src/content | |
parent | c50f463bc12da7e3a5de490b714b4ff1ea8d3e56 (diff) |
add Hint tests
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/hint.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/content/hint.js b/src/content/hint.js index 7979cf1..f59899d 100644 --- a/src/content/hint.js +++ b/src/content/hint.js @@ -2,6 +2,10 @@ import './hint.css'; export default class Hint { constructor(target, tag) { + if (!(document.body instanceof HTMLElement)) { + throw new TypeError('target is not an HTMLElement'); + } + this.target = target; let doc = target.ownerDocument @@ -31,8 +35,7 @@ export default class Hint { activate() { if (this.target.tagName.toLowerCase() === 'a') { - let href = this.target.href; - window.location.href = href; + this.target.click(); } } } |