Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divider element inserting extra <li> #3

Closed
wzub opened this issue Jan 25, 2013 · 5 comments
Closed

Divider element inserting extra <li> #3

wzub opened this issue Jan 25, 2013 · 5 comments
Assignees

Comments

@wzub
Copy link

wzub commented Jan 25, 2013

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:
Capture

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!

@PlanBrewski
Copy link
Collaborator

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?

@wzub
Copy link
Author

wzub commented Jan 25, 2013

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.

@PlanBrewski
Copy link
Collaborator

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!

@wzub
Copy link
Author

wzub commented Jan 25, 2013

Great, issue resolved. I noticed this in IE, Firefox & Chrome were hiding it. Thanks!

@PlanBrewski
Copy link
Collaborator

No problem, I'm glad to see how someone is using it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants