Just ran into (or just noticed) similar problem with the legacy code in our app.
Like Phil.Wheeler, also using a Sitemap data source. Not sure that changing the rendering mode to 3.5 is a good thing for us and the script hack to override Sys.WebForms.Menu did not work.
Problem:
This code is inserted auto-magically on every aspx page:
<script type='text/javascript'>new Sys.WebForms.Menu({ element: 'ctl00_MainNavMenu', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false });</script>
None of our pages has an element with id of 'ct100_MainNavMenu' so, we are seeing a javascript error in MenuStandards.js resolving tagName === 'DIV'. this.element is null.
Sys.WebForms.Menu = function(options) {
this.items = [];
this.depth = options.depth || 1;
this.parentMenuItem = options.parentMenuItem;
this.element = Sys.WebForms.Menu._domHelper.getElement(options.element);
if (this.element.tagName === 'DIV') {
var containerElement = this.element;
this.element = Sys.WebForms.Menu._domHelper.firstChild(containerElement);
this.element.tabIndex = options.tabIndex || 0;
options.element = containerElement;
options.menu = this;
this.container = new Sys.WebForms._MenuContainer(options);
Sys.WebForms.Menu._domHelper.setFloat(this.element, this.container.rightToLeft ? "right" : "left");
}
else {
this.container = options.container;
this.keyMap = options.keyMap;
}
Adding the following to our ASPX master file, as the last html before the tag seems to work (it gets rid of the problem):
<div id="ctl00_MainNavMenu" style="display:none">
<div id="neededToPreventSecondErrorAt_tabIndex"></div>
</div>
The rendered HTML looks like this:
<div id="ctl00_MainNavMenu" style="display: none; float: left;">
<div tabindex="0" role="menubar" class="static" style="position: relative; width: auto; float: left;"></div>
</div>
Not seeing any ill effects on any of our ASPX pages, testing on IE, FF, and Chrome. Clearly, there'll be a problem if an element is ever created on the page with the same ID. Not sure how likely that is unless we redo our app menus. I don't think it's any worse/riskier than overriding the webforms Menu javascript.