ep_comments_page
ep_comments_page copied to clipboard
Mouse event handlers called one extra time for every new comment until page reload
I noticed this while debugging something. I'm on etherpad 1.8.16, ep_comments_page 0.1.83.
In static/js/index.js, put a console.log or alert inside any or all of the following handlers (and perhaps others, for all I know):
this.container.on('mouseover', '.sidebar-comment', (e) => {......on('mouseout', '.sidebar-comment', (e) => {...this.padInner.contents().on('mouseover', '.comment', function (e) {...this.padInner.contents().on('click', '.comment', function (e) {...this.padInner.contents().on('mouseleave', '.comment', (e) => {...
Open a blank file. Add a comment. Trigger the events. You'll find that the handlers are fired a single time, as expected.
Now, try adding a new comment somewhere in the file. Trigger the events again. You'll find that the handlers are fired twice.
Add another comment. Trigger the events, the handlers are fired three times.
Reload the page.
Trigger the events. You'll find that the handlers are again fired a single time.