Add a span and class to menu items that has children I'm customizing the main menu using the Menu Block Module. I need to set a class for all li elements that has children regardless of level. I might need to add a span inside the a-tags as well. Is it possible to do this in the template.php or do I need to alter module files. I would preffere not to edit module files if possible. 

Like:

&lt;li class="expanded menu-mlid-871 has-children"&gt;
   &lt;a href="..."&gt;Menu item name&lt;span class="test"&gt;&lt;/span&gt;&lt;/a&gt;
   &lt;ul&gt; &lt;!-- (children items) --&gt; &lt;ul&gt;
&lt;/li&gt;


Is this doable with some:

function theme_menu_link(array $variables) { ...?... }


[edit]

Menu items with no children has the class="leaf". It should be possible to style the menu items li (has children) and then cancel the rule-set for the class li.leaf (has no children). The span can be added by using some li::after rule-set and removed with eg li.leaf::after {display:none;}

In this way it can be solved with CSS only. The problem is I need to use the  &lt;span class="test"&gt;&lt;/span&gt; for a click event. So at least I need a real span inside the li a witch is not a "leaf".

Anyone who can help me with a theme functions for this?
Menu items with no children has the class="leaf". It is possible to style the menu items li (has children) and then cancel the rule-set for the class li.leaf (has no children).

A span can be added to all li's (set to display:none for leafs).
How do I insert a &lt;span&gt; &lt;/span&gt; tag inside the &lt;a&gt; &lt;/a&gt; tag on my main menu