aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/injected.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'content_scripts/injected.coffee')
-rw-r--r--content_scripts/injected.coffee5
1 files changed, 3 insertions, 2 deletions
diff --git a/content_scripts/injected.coffee b/content_scripts/injected.coffee
index d833d09c..1c743134 100644
--- a/content_scripts/injected.coffee
+++ b/content_scripts/injected.coffee
@@ -10,8 +10,9 @@ injectedCode = (vimiumOnClickAttributeName) ->
_addEventListener = Element::addEventListener
Element::addEventListener = (type, listener, useCapture) ->
- @setAttribute vimiumOnClickAttributeName, "" if type == "click"
- _addEventListener.apply this, arguments
+ if type == "click"
+ try @setAttribute vimiumOnClickAttributeName, ""
+ _addEventListener?.apply this, arguments
script = document.createElement "script"
script.textContent = "(#{injectedCode.toString()})('#{vimiumOnClickAttributeName}')"