[wp-trac] [WordPress Trac] #52296: foreach not working on safari ipad ios9

WordPress Trac noreply at wordpress.org
Thu Jan 14 14:56:02 UTC 2021


#52296: foreach not working on safari ipad ios9
---------------------------------+------------------------------
 Reporter:  wishboneproductions  |       Owner:  (none)
     Type:  defect (bug)         |      Status:  new
 Priority:  normal               |   Milestone:  Awaiting Review
Component:  Bundled Theme        |     Version:  5.6
 Severity:  minor                |  Resolution:
 Keywords:  needs-patch          |     Focuses:  javascript
---------------------------------+------------------------------
Changes (by hellofromTonya):

 * component:  Menus => Bundled Theme


Old description:

> script: /assets/primary-navigation.js
> browser: safari (ipad iOS 9.3.5)
> bug: older safari browsers not supporting nodelist for forEach they need
> an Array
>
> Problem:
> el.closest( 'nav' ).querySelectorAll( '.sub-menu-toggle' ).forEach(
> function( button ) {
>
> Solution:
> Array.from(menu_dom.querySelectorAll( '.menu-wrapper > .menu-item-has-
> children' )).forEach( function( li ) {
>
> Notes:
> should be replaced a couple of times throughout the file

New description:

 In the Twenty Twentyone theme, older safari browsers do not support
 `nodelist` for `forEach` they need an `Array`.


 Theme: Twenty Twentyone
 script: twentytwentyone/assets/primary-navigation.js
 browser: safari (ipad iOS 9.3.5)

 Problem:
 el.closest( 'nav' ).querySelectorAll( '.sub-menu-toggle' ).forEach(
 function( button ) {

 Solution:
 Array.from(menu_dom.querySelectorAll( '.menu-wrapper > .menu-item-has-
 children' )).forEach( function( li ) {

 Notes:
 should be replaced a couple of times throughout the file

--

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


More information about the wp-trac mailing list