In Drupal 6, the version of jQuery we use would not allow a single function to be bound as an event handler multiple times. In Drupal 7, it seems that jQuery 1.6 will happily add the same named function to a single element multiple times, so we end up with events triggering multiple times.
For example:
- Install Form builder and the examples module.
- Visit the examples page and click on a field to open it. Click on it again to close it. Click again to open it.
- Now when you click to close it again, it will close and then open again.
What's happening here is that the click handler is getting triggered twice, one time that closes and another that opens. But in actuality what ends up happening the more times you open the field for editing, it adds another duplicate event handler every time.
This patch simply implements the typical guard-classes seen throughout Drupal. It does not use .once() for portability to D6.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | form_builder_guard-d6.patch | 1.42 KB | quicksketch |
| form_builder_guard.patch | 1.46 KB | quicksketch |
Comments
Comment #1
quicksketchCommitted plus this D6 patch (even though it's not needed there, it won't hurt).