[wp-trac] [WordPress Trac] #33359: Custom fields in media modal javascript events are unbound after ajax save method
WordPress Trac
noreply at wordpress.org
Fri Aug 14 18:56:06 UTC 2015
#33359: Custom fields in media modal javascript events are unbound after ajax save
method
--------------------------+-----------------------------------------
Reporter: LindsayBSC | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Media | Version: 4.2.4
Severity: normal | Resolution: worksforme
Keywords: | Focuses: javascript, administration
--------------------------+-----------------------------------------
Changes (by ericlewis):
* status: new => closed
* resolution: => worksforme
* milestone: Awaiting Review =>
Comment:
> Any javascript bound to a field created by the custom attachment fields
API (`attachment_fields_to_edit`) gets unbound (or removed) after the save
function is finished.
This depends on the method of event binding. After testing your code, I
found the events are actually bound in a way that persists after the save
function is finished. The issue is that the DOM state changes (i.e. color
changes) don't persist, which is because the attachment compat view is re-
rendered, initializing new DOM nodes that have default colors.
So the issue you're experiencing is that the entire attachment compat view
is rerendered whenever any compat field is saved. If that's an issue, I
would suggest a good reading of #22186 which documents moving
`attachment_fields_to_edit` filter into the media modal.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33359#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list