[wp-trac] [WordPress Trac] #45472: Incorrect wp_get_script_polyfill() call in script loader

WordPress Trac noreply at wordpress.org
Mon Dec 3 12:12:18 UTC 2018


#45472: Incorrect wp_get_script_polyfill() call in script loader
---------------------------+-----------------------
 Reporter:  swissspidy     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  5.0.1
Component:  Script Loader  |    Version:  5.0
 Severity:  minor          |   Keywords:  has-patch
  Focuses:                 |
---------------------------+-----------------------
 Script polyfills are currently loaded like this:

 {{{#!php
 did_action( 'init' ) && $scripts->add_inline_script(
         'wp-polyfill',
         wp_get_script_polyfill(
                 $scripts,
                 array(
                         '\'fetch\' in window' => 'wp-polyfill-fetch',
                         'document.contains'   => 'wp-polyfill-node-
 contains',
                         'window.FormData &&
 window.FormData.prototype.keys' => 'wp-polyfill-formdata',
                         'Element.prototype.matches &&
 Element.prototype.closest' => 'wp-polyfill-element-closest',
                 ),
                 'after'
         )
 );
 }}}

 This incorrectly passes `'after'` as the third parameter to
 `wp_get_script_polyfill()`, which only accepts two parameters. It's clear
 that this argument is meant for `add_inline_script()` instead.

 However, since `after` is the default argument for `add_inline_script()`
 anyway, it can be safely omitted

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45472>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list