From 2741b2d6df75d51ab2e50679fbccd4bdf479d113 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Wed, 24 Aug 2005 22:15:53 +0000 Subject: [PATCH] Bug 301357: Simplify context menu selection code, patch by Martijn Wargers , r=mconnor --- browser/base/content/browser.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index b2a15dfbf25..51d7982a54f 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4697,23 +4697,7 @@ nsContextMenu.prototype = { // Returns true if anything is selected. isContentSelection : function() { - var focusedWindow = document.commandDispatcher.focusedWindow; - var selection = focusedWindow.getSelection(); - if (selection.rangeCount == 0) { - return false; - } - var rangeFragment = selection.getRangeAt(0).cloneContents(); - if (rangeFragment.childNodes.length == 0) { - return false; - } - // The selection object may also report an empty text node if there is no selection. - var node = rangeFragment.childNodes[0]; - if (rangeFragment.childNodes.length == 1 && - node.nodeType == node.TEXT_NODE && - node.nodeValue.length == 0) { - return false; - } - return true; + return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed; }, searchSelected : function( charlen ) {