3

The ribbon on one specific site in a site collection will not load, it stays on loading, and two lists I have that use grouping will not expand, they also stay on loading. This is only happening on one specific site i.e. http://server/collection/abc/def/xyz, it doesn't happen on any other site in the collection http://server/collection/abc/def or http://server/collection/abc/def/ghi. This happens across multiple browsers and multiple users/machines. Site Actions still works. If you start at the home page of the site, the ribbon does load on the Page tab, but if you navigate anywhere else (to a list, library, calendar, etc) the ribbon does not work.

This is not due to any load balancers (we have none), loop back issues or DNS devolution (it only happens to one site). This error has appeared in the last ~12 days I would say; before that the ribbon and grouping worked fine. Single-server farm. No updates happened, server did not go down. IIS Reset is ineffective.

There is custom JS added to the master page for this site but it should be unrelated. It's used to add two custom Quick Launch links to upload stuff to the document library. This is the code (URLs and GUIDs replaced):

<SCRIPT language=javascript type=text/javascript>       
    function newDocLinkFn(){
        STSNavigate2(event,'/collection/abc/def/xyz/_layouts/NewLink.aspx?List={<<GUID>>}&RootFolder=/collection/abc/def/xyz/Documents&ContentTypeId=<<GUID>>&Source=/collection/abc/def/xyz/Documents/Forms/AllItems.aspx');
    }

    function uploadDocFn(){
        EditItem2(event, 
        '/collection/abc/def/xyz/_layouts/Upload.aspx?List={<<GUID>>}&RootFolder=/collection/abc/def/xyz/Documents&Source=<<document library URL>>');
    }
</SCRIPT>

Browser console shows this error upon debug:

SCRIPT5007: Unable to get property 'getElementsByTagName' of undefined or null reference

File: sp.js, Line: 2, Column: 282286


Here's some screenshots:

Ribbon not loading:

ribbon

Grouped list not expanding:

grouped list

Edit: I removed the custom JS code to see if that was the culprit but there was no change. Master page has been reset to site definition, the ribbon still does not load


Ran SP.js in DEBUG mode and got these results:

The error is thrown on line 11852, on the this.$D_2.getElementsByTagName('ul') call.

$3x_2: function() {ULS5Vl:;
    var $v_0 = this.$D_2.getElementsByTagName('ul');
    for (var $v_1 = 0, $v_2 = $v_0.length; $v_1 < $v_2; ++$v_1) {
        if (Sys.UI.DomElement.containsCssClass($v_0[$v_1], 'dynamic')) {
            var $v_3 = $v_0[$v_1].parentNode;
            $v_3.hoverDebouncer = 0;
            this.$3i_2($v_3);
        }
    }
},

Call stack:

  • SP.UI.AspMenu.prototype.$3x_2 [Line: 11852, Col: 9], sp.debug.js
  • SP.UI.AspMenu.prototype.initialize [Line: 11847, Col: 9], sp.debug.js
  • Sys$Component$endUpdate [Line: 2587, Col: 33], ScriptResource.axd
  • Sys$Component$create [Line: 2743, Col: 9], ScriptResource.axd
  • init_zz18_TopNavigationMenuV4 [Line: 708, Col: 43], viewlsts.aspx
  • NotifyEventAndExecuteWaitingJobs [Line: 5189, Col: 5], init.debug.js
  • NotifyScriptLoadedAndExecuteWaitingJobs [Line: 5206, Col: 2], init.debug.js
  • Global code [Line: 14900, Col: 1], sp.debug.js

This happens as soon as the page is refreshed on the View All Site Content page, not even trying to click anything yet and not even in a document library. Again it seems strange me because the Site Actions menu still works fine.

It appears the .getElementsByTagName('ul') isn't returning anything, in the function directly above the one in the snippet above:

initialize: function() {ULS5Vl:;
    SP.UI.AspMenu.callBaseMethod(this, 'initialize');
    this.$D_2 = this.get_element().getElementsByTagName('ul')[0];
    this.$3x_2();
    this.$3z_2();
},

this is pointing to the SP.UI.AspMenu object and the get_element() returns an object but that object, at least from the IE debugger, does not appear to have any method called getElementsByTagName().

One other weird thing I just noticed is that on the home page of the site I have an OOTB Announcements web part and when I'm debugging with the console open and I click the "Add new announcement" button, it throws an error from NewForm.aspx saying permission denied when it tries to do this:

document.write('<script type="text/javascript" src="/_layouts/1033/init.debug.js?rev=OclaJxOddeqyem2grw%2Br8Q%3D%3D"></' + 'script>');

Not sure if it's related or just another issue.

This question has an open bounty worth +50 reputation from Arin Zandbergen ending in 20 hours.

This question has not received enough attention.

  • With your custom code, try to either use SP.SOD.executeFunc("sp.js","SP.ClientContext",yourCodeHandle); or _spBodyOnLoadFunctionNames.push("yourCodeHandle"); instead of things like $(document).ready(yourCodeHandle); as they wait for the required SharePoint scripts to load and will prevent some interference. Also if you're loading any external JavaScript libraries on this site you may causing issues there too. For instance, loading jQuery twice on a page doesn't work very well... – KGlasier Feb 2 at 17:16
  • @KGlasier I tried taking out the custom JS and reset the master page to site definition to see if it made any difference but it didn't, the ribbon still does not load – Arin Zandbergen Feb 15 at 18:06
2

Unfortunately, that's a very generic error message. To dig into it, you'll need to get SharePoint to load the *.debug.js versions of it's scripts. The easiest way to do that is to modify the master page:

  • Find the ScriptManager tag.
  • Add the attribute ScriptMode="Debug", or if ScriptMode is already present change it to "Debug" (you said master page is reset, so ScriptMode probably needs to be added)

Once you do that, reload your page, and find out what line it says the error occurred on in sp.js (I know the console says line 2 right now, but that's because it's minimized, everything is on line 2). Then go to that line, put in a break point, and see what it's trying to do when it crashes (which may or may not be the first time it hits that line). i.e. what tag is it trying get? And who's calling it (look at the stack trace)?

With more information, someone may be able to help.

  • I added some more details to the original question at the bottom. Honestly I'm not sure of what to make of it, I've never seen anything like this, especially since it's only happening on this one site and none of the others in the site collection. – Arin Zandbergen Feb 15 at 22:25
  • The fact that it's only happening on one site collection is a clue itself. That tends to lead to something like JavaScript in mater page or just broken master page (you've already eliminated that), JavaScript through user custom actions, custom full trust features (I'm guessing you would have mentioned that). What version of SharePoint? Next thing I would look for is I would look at every JavaScript reference in the live DOM or the Network tab of developer tools, for anything that looks suspicious, particularly for anything that resides in the site collection (style lib, mater gallery, etc.) – Joe McShea Feb 16 at 0:06
  • Also, this.$D_2 is obviously an HTML element. What is it? Take a look at this.$D_2.outerHTML in the watch window. – Joe McShea Feb 16 at 0:13
  • Also, look at the Network tab on page load to see if you're getting any errors loading resources, especially access denied. – Joe McShea Feb 16 at 0:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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