I'm creating a Google Chrome extension and I try to modify Twitter's homepage code for that.
I need to be notified whenever a user clicks on a --- More
button which are present in every tweet. Basically I use the following event delegation code :
$(document).on('click', '.dropdown-toggle', function() {
console.log('Hi !');
});
It works for all tweets on the homepage and those loaded via Ajax (that's why I use event delegation :D), but it doesn't work on the sub-tweets/answers that appear when you expand a tweet in the timeline. Yet the menus still have the dropdown-toggle
class but the callback doesn't get called.
So I though that Twitter's code was calling event.stopPropagation()
or similar so I tried to remove event listeners on one of them by calling $(button).off()
but it didn't work either.