[wp-trac] [WordPress Trac] #35107: wp_nav_menu outputs tags without line breaks in 4.4, causes strange bug with justified text

WordPress Trac noreply at wordpress.org
Tue Dec 15 21:05:21 UTC 2015


#35107: wp_nav_menu outputs tags without line breaks in 4.4, causes strange bug
with justified text
--------------------------+-----------------------------
 Reporter:  wp-architect  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 After updating from 4.3.1 to 4.4, justified alignment being applied via
 CSS to my main navigation no longer worked.

 After inspecting the problem, It turns out 4.4 was displaying HTML tags on
 the same line which causes a strange bug in Google Chrome on latest OSX
 (untested in other browsers). See stackoverflow:
 [https://stackoverflow.com/questions/24781842/justified-horizontal-list-
 with-minified-html]

 Reapplying line breaks to the menu output solved this issue.

 '''Proposed fix''' - NOTE: I am a first time contributor and would like
 the opportunity to submit a pull request for this small fix, if it is
 legitimate.

 Restore the following Walker_Nav_Menu function in wp-includes/nav-menu-
 template.php from 4.3 -
 {{{#!php
 <?php
 /**
          * Ends the element output, if needed.
          *
          * @see Walker::end_el()
          *
          * @since 3.0.0
          *
          * @param string $output Passed by reference. Used to append
 additional content.
          * @param object $item   Page data object. Not used.
          * @param int    $depth  Depth of page. Not Used.
          * @param array  $args   An array of arguments. @see wp_nav_menu()
          */
         function end_el( &$output, $item, $depth = 0, $args = array() ) {
                 $output .= "</li>\n"; // added \n to appear on new lines
         }
 }}}



 Are you using either the latest version of WordPress, or the latest
 development version? If not, please update first.

 '''Yes, this occurs on 4.4'''

 What steps should be taken to consistently reproduce the problem?

 '''Activate any theme that uses the wp_nav_menu. View site and see source
 code for navigation output.'''

 Does the problem occur even when you deactivate all plugins and use the
 default theme?

 '''Yes'''

 In case it's relevant to the ticket, what is the expected output or
 result? What did you see instead?

 4.3

 {{{
 <div class="menu">
 <ul>
 <li><a href="#">Menu Item</a></li>
 <li><a href="#">Menu Item</a></li>
 <li><a href="#">Menu Item</a></li>
 <li><a href="#">Menu Item</a></li>
 </ul>
 </div>
 }}}

 4.4

 {{{
 <div class="menu"><ul><li><a href="#">Menu Item</a></li><li><a
 href="#">Menu Item</a></li><li><a href="#">Menu Item</a></li><li><a
 href="#">Menu Item</a></li></ul></div>
 }}}

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


More information about the wp-trac mailing list