Divider element inserting extra <li>
Hi
I've noticed that when I add a divider element to the menu, the output contains an extra </li> and messes up the layout, not to mention a validation error.
Here's a shot of the menu structure:
Here's the output:
<nav class="pull-right dropdown">
<ul id="menu-main" class="nav nav-pills">
<li id="menu-item-88" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-88 dropdown">
<a href="" data-toggle="dropdown"
data-target="#" class="dropdown-toggle"> <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li id="menu-item-84" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-84">
<a href=""></a>
</li>
<li class="divider"></li>
</li>
<li id="menu-item-147" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-147">
<a href=""></a>
</li>
<li id="menu-item-236" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-236">
<a href=""></a>
</li>
<li id="menu-item-295" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-295">
<a href=""></a>
</li>
</ul>
</li>
<li id="menu-item-72" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-72">
<a href=""></a>
</li>
<li id="menu-item-66" class="highlight menu-item menu-item-type-post_type menu-item-object-page menu-item-66">
<a href=""></a>
</li>
</ul>
</nav>
Now according to the W3C validator, the </li> just before <li id="menu-item-72"> is and "end tag for element "LI" which is not open."
When I remove the Divider from the Wordpress menu, the validation error is gone. I've never really understood how the Walker works, so I have no clue what's going on here - any advice?
Thanks!
The closing is correct, there seems to be a missing . Because the un-ordered list was not closed the validator sees no open in the current list only. This is interesting because I noticed and solved this issue in an earlier commit, and I don't get the same result.
Are you using the most recent version of the file?
Yes, I'm using version 1.2.1. If it helps, here's the link where you can see this live: http://www.aieseckhi.com/ There's only one divider in the menu currently, in the 2nd link.
Interesting, I found the issue. The way WordPress walkers work is one function generates the menu item and another adds the closing I had included the closing for the divider in the function. It seems Chrome automatically removes extra tags in the source so I didn't initially notice it, thanks for pointing it out.
Version 1.2.2 is up now!
Great, issue resolved. I noticed this in IE, Firefox & Chrome were hiding it. Thanks!
No problem, I'm glad to see how someone is using it!