Autonav Blank Classes

Permalink
Why does the Autonav get a weird class markup on the <li> and <a> if they have no classes?
If no classes, the markup becomes <li class>, without quotes. Why is this happening?

GBNT
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi GBNT,

What version of concrete5 are you using?

Do you have a link to a website where this is happening?
GBNT replied on at Permalink Reply
GBNT
Hi MrKDilkington,


http://dev.gbnt.pt/c5-test/

here's a link of a fresh install, with nothing but a default autonav on the homepage.
Links 1 and 2 have no class, so they're rendering it as
<a class></a>


I'm using the latest (5.6.3.3)
GBNT replied on at Permalink Reply
GBNT
It seems to only happen in Safari and Chrome. Doesn't happen on Firefox.
I'm on OS X Yosemite, I can't test on a windows machine right now.
goodnightfirefly replied on at Permalink Best Answer Reply
goodnightfirefly
It is because in the autonav generation we have

echo '<li class="' . $ni->classes . '">'; //opens a nav item
echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';


Since there is nothing in $ni->classes, nothing is output for the class attributes.

Safari and Chrome just display empty attributes in the developer inspector without the "", whereas Firefox doesn't.

If you view the page source (instead of inspecting through the developer tools) you will see the actual output is <li class="">.

Basically, its nothing to worry about.