What was wrong? `initializeCommentDropdown` is called when a new comment is added. `initializeCommentDropdown` calls `addDropdownListener(dropdown)` on all `.dropbtn` elements. Elements with the `.dropbtn` class already exist on the page so an extra listener is added to it whenever a comment is added. How was it fixed? Whenever a dropdown listener is added to an element with the `.dropbtn` class, an attribute is set on that element so we know it already has a dropdown listener. When we add listeners to elements with the `.dropbtn` class in the future, we don't add them to elements with the attribute. |
||
|---|---|---|
| .. | ||
| initializers | ||
| lib | ||
| utilities | ||
| .eslintrc.js | ||
| application.js | ||
| base.js.erb | ||
| initializePage.js | ||
| internal.js | ||
| jquery_s3_upload.js | ||
| serviceworker-companion.js | ||