Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a document center with a custom master page. The page is designed with IE9/HTML5/CSS3 in mind. In my other question, I worked out how to fix the IM Presence icons by fixing some core SharePoint javascript that is defunct as of IE9. This time, I have noticed that when I click the context menus for items in a ListView web part or document library, the "Send To" submenu does not expand. This menu still works in Firefox, but people should just ideally be using IE for SharePoint for most of the functions to work properly. Has anyone else seen this, specifically? I know it must be related to the expandos issue in my other question but I have done a lot of digging and not been able to unearth the key location for the problem. It's like the javascript just stops running somewhere with little or no explanation.

Thanks,

  • Matt

Update 12/7/2012

If you look at the comments for the answer you should get good information on how and where to implement the fix.

share|improve this question
1  
To add: I was able to reproduce the issue. All I've changed in my default master page (v4.master) were two things: DOCTYPE tag and the X-UA-Compatible meta tag. The new tags look as follows: <!DOCTYPE html> and <meta http-equiv="X-UA-Compatible" content="IE=9;IE=Edge"/>. After this, I cleared the browser cache, reloaded the page, and beheld the issue. Hope this info will help other experts to participate in answering the question. –  Andrey Markeev Feb 3 '12 at 21:30
    
@omlin Thanks, I should have mentioned that part of it in this post, too. –  Matt Feb 3 '12 at 22:16
    
Any specific position for core.ie9fix.js, I have tried a couple places in master page, it doesn't work somehow. –  Shawn Dec 5 '12 at 5:56
add comment

1 Answer 1

up vote 5 down vote accepted

Comparing execution in IE and in FireFox, I've found out that the problem is that a special "submenuRoot" attribute in IE is not set on the li element, which represents the "Send To" menu node.

After some painful debugging, I've tracked the issue back to method MergeAttributes in the core.js file. This method looks like this:

function MergeAttributes(oTarget, oSource)
{ULSsa6:;
    if (browseris.nav || oTarget.mergeAttributes==null)
    {
            // ... code for non-IE browsers, skipped for clarity ...
    }
    else
    {
        oTarget.mergeAttributes(oSource);
    }
}

The oTarget.mergeAttributes(oSource); line, which is obviously the only code which executes in IE, doesn't work as expected. Given oSource.submenuRoot attribute defined and correctly set, after this call, oTarget.submenu remains undefined.

Obviously, the mergeAttributes method works differently for different content modes.

You have several options to fix this, the most obvious would be to override the MergeAttributes function from the masterpage, removing the if condition, and leaving only the first code block. I've tried this, and it works fine (I have IE 9.0.8112.16421).

The fixed code for the function is presented below:

function MergeAttributes(oTarget, oSource)
{
    var oAttributes=oSource.attributes;
    for (var i=0; i < oAttributes.length; i++)
    {
        var oAttrib=oAttributes[i];
        if (oAttrib !=null &&
            oAttrib.specified &&
            oAttrib.nodeName !="id" &&
            oAttrib.nodeName !="ID" &&
            oAttrib.nodeName !="name")
        {
            oTarget.setAttribute(oAttrib.nodeName, oAttrib.nodeValue);
        }
    }
    if (oSource.getAttribute("type") !=null)
        oTarget.setAttribute("type", oSource.getAttribute("type"));
    if (oSource.submenuRoot !=null)
        oTarget.submenuRoot=oSource.submenuRoot;
}
share|improve this answer
    
thank you so much for the total solution to this problem! I will implement it on Monday and let you know how it goes! –  Matt Feb 4 '12 at 23:28
    
Did you have to put this in a specific place? I have tried this and on my server it is still picking the version in core.js over mine. I ended up having to create a file called core.ie9fix.js and place that in the 1033 folder, per the instructions on this page –  Matt Feb 6 '12 at 2:45
1  
I merely overrode the function on a particular page, using JS console. I don't have a site with HTML5-enabled master page yet, so I didn't try overriding it over the whole site. Probably, as an alternative to your solution, you at least could inject the overload code through _spBodyOnLoadFunctionNames feature. –  Andrey Markeev Feb 6 '12 at 5:57
    
Maybe that's what it is, then. I tried it directly from the master page to begin with. There are a lot of server controls that mess with javascript and I think that was what was doing the stepping-on of your function. At any rate, your suggestion did work, so thanks again! –  Matt Feb 6 '12 at 15:16
    
You're welcome! Please, don't hesitate to share any further issues, I'm highly interested in HTML5-enabled SharePoint portals :) –  Andrey Markeev Feb 6 '12 at 15:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.