I have a very odd problem that cropped up yesterday on one my sites. The site is Drupal 7 with the stock toolbar module installed. When you access the site for the first time logged in as an admin user, the Content menu link does not work. All the other menu links work fine. When you go to the Structure page next, the Content menu works correctly.
Looking at the source, the A tag for the Content menu does not have an HREF attribute. All the other menu links do. When you go to the Structure page, the Content menu has an HREF attribute as expected.
I looked at the menu_links table and everything looks good.
I ran debug through the toolbar.module and the array data is correct.
I ran debug into the toolbar.tpl.php file calling render($toolbar['toolbar_menu']). The array data is correct.
I'm now looking to see what else might be causing the HREF to "disappear" from the Content menu.
Has anyone seen this before?
The first commenter mentioned looking at the static page source (great idea...DevTools has made me lazy ;) )
<li class="menu-9 path-admin-content">
<a href="/admin/content" id="toolbar-link-admin-content" title="Find and manage content.">
<span class="icon"></span>Content
<span class="element-invisible">(Find and manage content.)</span></a></li>
So the HREF is in the A tag. I'm looking at all the Javascript on the site now.
** UPDATED ** I added the following code (from http://addyosmani.com/blog/mutation-observers/):
var observer = new MutationObserver(function (mutations) {
// Whether you iterate over mutations..
mutations.forEach(function (mutation) {
// or use all mutation records is entirely up to you
var entry = {
mutation: mutation,
el: mutation.target,
value: mutation.target.textContent,
oldValue: mutation.oldValue
};
console.log('Recording mutation:', entry);
});
});
var options = {
childList: true,
attributes: true,
characterData: true,
subtree: true,
attributeOldValue: true,
characterDataOldValue: true,
attributeFilter: null
};
var target = document.querySelector('#toolbar-link-admin-content');
observer.observe(target,options);
This is the output which confirms that something is modifying the DOM.
Recording mutation: Object {mutation: MutationRecord, el: a#toolbar-link-admin-content, value: "Content (Find and manage content.)", oldValue: "/admin/content"}
Recording mutation: Object {mutation: MutationRecord, el: a#toolbar-link-admin-content, value: "Content (Find and manage content.)", oldValue: ""}
How do I go about finding what is causing the change? What code fired the observer?