Skip to content

Mouse event handlers called one extra time for every new comment until page reload #214

@orblivion

Description

@orblivion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions