[wp-trac] [WordPress Trac] #38550: Remove jQuery dependency from wp-custom-header.js

WordPress Trac noreply at wordpress.org
Wed Nov 2 21:56:27 UTC 2016


#38550: Remove jQuery dependency from wp-custom-header.js
--------------------------+-------------------------
 Reporter:  joemcgill     |       Owner:  joemcgill
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.7
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript
--------------------------+-------------------------

Comment (by joemcgill):

 Thanks @bradyvercher,

 > Most themes are going to be using jQuery, so they'll understand how to
 listen for events using it. With this approach, they'll have to learn an
 alternative approach. Granted it is a native API, so that learning
 experience could be worthwhile, depending on your vantage point.

 I don't think there is any problem with themes using jQuery to listen for
 this event. In fact, we could do something like this in Twenty Fourteen if
 we want:

 {{{
 // Update masthead offset once a custom header video loads.
 $( document ).on( 'wp-custom-header-video-loaded', function() {
         mastheadOffset = $( '#site-header' ).height();
 } );
 }}}

 The other two issues—play/pause button and allowing themes to replace the
 `supportsVideo()` test—should be separate tickets, IMO.

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


More information about the wp-trac mailing list