Permalink
Browse files

MDL-45096 block_navigation: Check for existence of the siteadminbranc…

…h before modifying it

Prevents JS errors in some themes when admin block is hidden
1 parent 291bb58 commit 06a76addad76b591a908d5a939ed6f312c5425d7 @mrclay mrclay committed with Sam Hemelryk Apr 14, 2014
@@ -275,10 +275,12 @@ TREE.prototype = {
M.block_navigation.expandablebranchcount++;
this.branches[siteadminbranch.get('id')] = siteadminbranch;
// Remove link on site admin with JS to keep old UI.
- var siteadminlinknode = siteadminbranch.node.get('childNodes').item(0);
- if (siteadminlinknode) {
- var siteadminnode = Y.Node.create('<span tabindex="0">'+siteadminlinknode.get('innerHTML')+'</span>');
- siteadminbranch.node.replaceChild(siteadminnode, siteadminlinknode);
+ if (siteadminbranch.node) {
+ var siteadminlinknode = siteadminbranch.node.get('childNodes').item(0);
+ if (siteadminlinknode) {
+ var siteadminnode = Y.Node.create('<span tabindex="0">'+siteadminlinknode.get('innerHTML')+'</span>');
+ siteadminbranch.node.replaceChild(siteadminnode, siteadminlinknode);
+ }
}
}
if (M.block_navigation.expandablebranchcount > 0) {

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -274,10 +274,12 @@ TREE.prototype = {
M.block_navigation.expandablebranchcount++;
this.branches[siteadminbranch.get('id')] = siteadminbranch;
// Remove link on site admin with JS to keep old UI.
- var siteadminlinknode = siteadminbranch.node.get('childNodes').item(0);
- if (siteadminlinknode) {
- var siteadminnode = Y.Node.create('<span tabindex="0">'+siteadminlinknode.get('innerHTML')+'</span>');
- siteadminbranch.node.replaceChild(siteadminnode, siteadminlinknode);
+ if (siteadminbranch.node) {
+ var siteadminlinknode = siteadminbranch.node.get('childNodes').item(0);
+ if (siteadminlinknode) {
+ var siteadminnode = Y.Node.create('<span tabindex="0">'+siteadminlinknode.get('innerHTML')+'</span>');
+ siteadminbranch.node.replaceChild(siteadminnode, siteadminlinknode);
+ }
}
}
if (M.block_navigation.expandablebranchcount > 0) {
Oops, something went wrong.

0 comments on commit 06a76ad

Please sign in to comment.