diff options
| author | Stephen Blott | 2017-12-18 13:03:54 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2017-12-18 13:03:54 +0000 | 
| commit | d9b6d5e18839d1af509d859af5faed880f43fe1e (patch) | |
| tree | fe5c038e896636b0a3c6b9df48ee8626a2efd690 | |
| parent | ab8783f1e3a60cb806f982d9b1616293a0f6613d (diff) | |
| download | vimium-d9b6d5e18839d1af509d859af5faed880f43fe1e.tar.bz2 | |
Do not use vimiumOnClickAttributeName variable...
... use literals instead.
For some reason, on Firefox, using `vimiumOnClickAttributeName` was
causing link hints to fail silently (on Facebook).  It's not at all
clear why this was happening.
Simply repeating the literal fixes the issue.
Fixes #2879.
| -rw-r--r-- | content_scripts/injected.coffee | 8 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 2 | 
2 files changed, 4 insertions, 6 deletions
| diff --git a/content_scripts/injected.coffee b/content_scripts/injected.coffee index 1c743134..4148ffa5 100644 --- a/content_scripts/injected.coffee +++ b/content_scripts/injected.coffee @@ -3,19 +3,17 @@  # This is based on method 2b here: http://stackoverflow.com/a/9517879, and  # @mrmr1993's #1167. -window.vimiumOnClickAttributeName = "_vimium-has-onclick-listener" - -injectedCode = (vimiumOnClickAttributeName) -> +injectedCode = () ->    # Note the presence of "click" listeners installed with `addEventListener()` (for link hints).    _addEventListener = Element::addEventListener    Element::addEventListener = (type, listener, useCapture) ->      if type == "click" -      try @setAttribute vimiumOnClickAttributeName, "" +      try @setAttribute "_vimium-has-onclick-listener", ""      _addEventListener?.apply this, arguments  script = document.createElement "script" -script.textContent = "(#{injectedCode.toString()})('#{vimiumOnClickAttributeName}')" +script.textContent = "(#{injectedCode.toString()})()"  (document.head || document.documentElement).appendChild script  script.remove() diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index ba9ada38..44f7a5f5 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -707,7 +707,7 @@ LocalHints =          reason = "Open."      # Detect elements with "click" listeners installed with `addEventListener()`. -    isClickable ||= element.hasAttribute vimiumOnClickAttributeName +    isClickable ||= element.hasAttribute "_vimium-has-onclick-listener"      # An element with a class name containing the text "button" might be clickable.  However, real clickables      # are often wrapped in elements with such class names.  So, when we find clickables based only on their | 
