108595 - Add a method for determining whether or not a context menu separator should be shown by determining if there are any items prior to the separator that are not hidden. r=kerz, sr=blake

This commit is contained in:
ben%netscape.com 2001-11-06 01:41:03 +00:00
parent 780a1792ac
commit 2a09c75163

View File

@ -745,5 +745,22 @@ nsContextMenu.prototype = {
} else {
return(node.localName.toUpperCase() == "TEXTAREA");
}
},
// Determines whether or not the separator with the specified ID should be
// shown or not by determining if there are any non-hidden items between it
// and the previous separator.
shouldShowSeparator : function ( aSeparatorID )
{
var separator = document.getElementById(aSeparatorID);
if (separator) {
var sibling = separator.previousSibling;
while (sibling && sibling.localName != "menuseparator") {
if (sibling.getAttribute("hidden") != "true")
return true;
sibling = sibling.previousSibling;
}
}
return false;
}
};