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

git-svn-id: svn://10.0.0.236/trunk@107404 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ben%netscape.com
2001-11-06 01:41:03 +00:00
parent 7c3257d6ab
commit 8f4806600a

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;
}
};