{"action":"created","issue":{"url":"https://api.github.com/repos/philc/vimium/issues/1859","labels_url":"https://api.github.com/repos/philc/vimium/issues/1859/labels{/name}","comments_url":"https://api.github.com/repos/philc/vimium/issues/1859/comments","events_url":"https://api.github.com/repos/philc/vimium/issues/1859/events","html_url":"https://github.com/philc/vimium/pull/1859","id":111984162,"number":1859,"title":"Enable link hints for all elements with `click` listeners","user":{"login":"mrmr1993","id":1847343,"avatar_url":"https://avatars.githubusercontent.com/u/1847343?v=3","gravatar_id":"","url":"https://api.github.com/users/mrmr1993","html_url":"https://github.com/mrmr1993","followers_url":"https://api.github.com/users/mrmr1993/followers","following_url":"https://api.github.com/users/mrmr1993/following{/other_user}","gists_url":"https://api.github.com/users/mrmr1993/gists{/gist_id}","starred_url":"https://api.github.com/users/mrmr1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrmr1993/subscriptions","organizations_url":"https://api.github.com/users/mrmr1993/orgs","repos_url":"https://api.github.com/users/mrmr1993/repos","events_url":"https://api.github.com/users/mrmr1993/events{/privacy}","received_events_url":"https://api.github.com/users/mrmr1993/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-17T20:53:51Z","updated_at":"2015-10-18T18:33:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/philc/vimium/pulls/1859","html_url":"https://github.com/philc/vimium/pull/1859","diff_url":"https://github.com/philc/vimium/pull/1859.diff","patch_url":"https://github.com/philc/vimium/pull/1859.patch"},"body":"This PR is a rebase of #1167 onto current master, and fixes the method used so that\r\n* there are no longer any problems with CSP\r\n* `addEventListener` is always hooked before any page scripts are run.\r\n\r\nThis supersedes #1405, but without dropping any legacy hint conditions as done there.\r\n\r\nFrom #1167:\r\n\r\n> This enables link hint support for clickable elements such as eg. the quiz choices on [this Buzzfeed quiz](http://www.buzzfeed.com/adamellis/this-palm-reading-quiz-will-reveal-your-future#2s6on3d) or the slideshow navigation buttons on the [Mercedes website](http://www5.mercedes-benz.com/en/).\r\n\r\n> This PR\r\n\r\n> * fixes #1091 \r\n> * fixes #993 \r\n> * fixes #861 \r\n> * improves the situation for #1157 (some clickable elements still don't receive link hints).\r\n\r\nEdit: [This JSFiddle](http://jsfiddle.net/p7w9yvsn/2/) is useful for testing."},"comment":{"url":"https://api.github.com/repos/philc/vimium/issues/comments/149037208","html_url":"https://github.com/philc/vimium/pull/1859#issuecomment-149037208","issue_url":"https://api.github.com/repos/philc/vimium/issues/1859","id":149037208,"user":{"login":"gdh1995","id":5547703,"avatar_url":"https://avatars.githubusercontent.com/u/5547703?v=3","gravatar_id":"","url":"https://api.github.com/users/gdh1995","html_url":"https://github.com/gdh1995","followers_url":"https://api.github.com/users/gdh1995/followers","following_url":"https://api.github.com/users/gdh1995/following{/other_user}","gists_url":"https://api.github.com/users/gdh1995/gists{/gist_id}","starred_url":"https://api.github.com/users/gdh1995/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdh1995/subscriptions","organizations_url":"https://api.github.com/users/gdh1995/orgs","repos_url":"https://api.github.com/users/gdh1995/repos","events_url":"https://api.github.com/users/gdh1995/events{/privacy}","received_events_url":"https://api.github.com/users/gdh1995/received_events","type":"User","site_admin":false},"created_at":"2015-10-18T18:33:20Z","updated_at":"2015-10-18T18:33:20Z","body":"> `<script src=\"\">` `.async = false`\r\n\r\nYou are right. When I tested local \"file:///\" files, `async = false` worked, but it failed for iframes running on fiddle.\r\n\r\nI captured and read the timeline, and found it took so long to load a new script file that Chrome finished parsing DOM tree. In your implementation, a **synced** XHR request blocks the whole thread, which makes the PR have a chance to work. So I shouldn't change it.\r\n\r\n> In my test, it did not call markTargetClickable in link_hints.coffee.\r\n\r\nI'm sorry I didn't explain my test. What I did is just to call `addEventListener` after the page is loaded. I've retried several times and it did not work.\r\n\r\nThere's a race condition between:\r\n* addEventListener_hook.coffee:20 `registrationElement.dispatchEvent registrationEvent`\r\n* vimium_frontend.coffee:192 `installListener \"VimiumRegistrationElementEvent\"` in `window.installListeners`\r\n\r\nFix: add `\"VimiumRegistrationElementEvent\"` handler to `window` when vimium_frontend is initing."}}