At some point in an update in the last few months, Drupal (7) started routinely triggering attached behaviours twice.
At first I thought "this is my fault, my behaviours should check to see if they've been run in this context already", and I set about using jQuery's once()
(and other such solutions).
However I'm convinced now that this is a wider problem. e.g. the admin_menu
module generates 2 admin menus.
Has anyone found this and the cause of it and a solution (beyond patching every module in use to check for duplicate calls)? I'm not sure where to start looking!
Nb. I've said "drupal" is doing this, I suppose it could be a contrib module that's causing the behaviour. I've seen it across several sites (I manage a dozen or so)
.once()
. So probably before there was no ajax on that page which explains why "It didn't used to do this."