diff options
| author | Teddy Wing | 2017-09-29 00:22:45 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-09-29 00:56:13 +0200 | 
| commit | 6e9040f7ef45ef8262cdbebab719cd961c5b1147 (patch) | |
| tree | 43543915e052d66e2b3d845cb2103d643191da7c /COPYING | |
| parent | a56fc2cdc16929216bea1db71b76641152a9c00b (diff) | |
| download | GitHub-Apple-Option-P-to-Preview-6e9040f7ef45ef8262cdbebab719cd961c5b1147.tar.bz2 | |
Enable listener for all comment fields including future ones
The keyboard shortcut now works on all comment fields, including those
that are created after page load.
Thanks to this Stack Overflow answer from 'adeneo' and Suraj Jain:
https://stackoverflow.com/questions/20330945/how-to-addeventlistener-to-future-dom-elements/20331016#20331016
It takes advantage of the fact that JavaScript events bubble. We attach
an event to `<body>`, which we can be sure will always be there (even
across GitHub's Turbolinks), and in the keydown event listener check to
see whether we were called on the right element.
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions
