зеркало из https://github.com/mozilla/pjs.git
Bug 301357: Simplify context menu selection code, patch by Martijn Wargers <martijn.martijn@gmail.com>, r=mconnor
This commit is contained in:
Родитель
33db3e9263
Коммит
2741b2d6df
|
@ -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 ) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче