From 8f4806600a4a3fa3375d8b7a08c3f4729d69dea0 Mon Sep 17 00:00:00 2001 From: "ben%netscape.com" Date: Tue, 6 Nov 2001 01:41:03 +0000 Subject: [PATCH] 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 --- .../resources/content/nsContextMenu.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mozilla/xpfe/communicator/resources/content/nsContextMenu.js b/mozilla/xpfe/communicator/resources/content/nsContextMenu.js index 2a78f2cdb7a..f4dcf492f69 100644 --- a/mozilla/xpfe/communicator/resources/content/nsContextMenu.js +++ b/mozilla/xpfe/communicator/resources/content/nsContextMenu.js @@ -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; } };