I'm writing a Firefox extension to add a context menu element and I can get both the DOM element and the selected text, but can't manage to get the unselected word on which the right click event was fired. I assume it must be possible, since the spell-checker does it, or is that a special inbuilt function?
Any ideas? Here is the code to get the other two:
oncommand="if(gContextMenu.isTextSelected) rightClick(document.commandDispatcher.focusedWindow.getSelection().toString()); else rightClick(gContextMenu.target.innerHTML);"