[wp-trac] [WordPress Trac] #32423: Media Elements Multiple Instances

WordPress Trac noreply at wordpress.org
Fri Sep 4 20:43:50 UTC 2015


#32423: Media Elements Multiple Instances
--------------------------+--------------------------------------------
 Reporter:  northeme      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  ui, accessibility, javascript
--------------------------+--------------------------------------------

Comment (by bradyvercher):

 I wasn't able to replicate the first issue reported by @northeme, but I
 would like to see some improvement on the second point.

 Making the core initialization method idempotent and exposing it publicly
 would allow it to be called by other scripts during partial page loads.
 Currently, scripts need to duplicate the logic and account for media
 elements that have already been initialized.
 [https://github.com/Automattic/jetpack/blob/573c196738e472ef5c1fccc6cf7b89a689ccf13d/modules
 /infinite-scroll/infinity.js#L392-L426 Here's an example] in Jetpack's
 Infinite Scroll module of the hoops that need to be jumped through.

 The patch I attached exposes the initialization method at
 `wp.mediaelement.initialize()` and makes it idempotent to prevent nasty
 side-effects caused by initializing media elements more than once.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32423#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list