[wp-hackers] Widgets.php jquery change effectively breaks the about-me-widget control
jbouantoun at gmail.com
Sat Mar 5 10:44:41 UTC 2011
In a recent change to wordpress the widgets.js script was change to use
jquery .live('click') binding on the save widget button:
Unfortunately a quirk of the way jquery live call works means the only way
to remove the binding is to use the die call with the exact same jquery
selector string that was used to create the live.
Now in the about-me-widget in order to get the tinyMCE html moved to it's
textarea before the save event is triggered I have been rebinding the click
event on save button on the about-me-widget. This was working up until now
because it was using a bind() call, which meant I could unbind() it and bind
my custom save event (that simply saved the html changed the original save
event). I can no longer do this because I can't selectively unbind the click
event of just my widget's save button due to the quirk in the way the live()
The ideal solution would be to have a widget save hook that worked on the
client side. Is this even a possibility?
The dirty alternative is to literally unbind all the save button click
events and rebind them with my click event and simply check the source of
the save button click event every time it is fired. But this just seems
really, really dirty to me. Dirty than what I had to do before.
Is this the only way to go? Is there any chance to convince the wordpress
devs to change back to using the bind() method or possibly add a client side
save event hook to register for?
More information about the wp-hackers