[wp-trac] [WordPress Trac] #52296: Twenty Twenty-One: primary-navigation's forEach not working on safari ipad ios9 (was: foreach not working on safari ipad ios9)

WordPress Trac noreply at wordpress.org
Thu Jan 14 14:58:08 UTC 2021


#52296: Twenty Twenty-One: primary-navigation's 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
---------------------------------+------------------------------
Description changed by hellofromTonya:

Old 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

New description:

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


 Theme: Twenty Twenty-One
 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:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list