[Project_owners] How to get selected text (Solved it)

Neil neil at parkwaycc.co.uk
Fri Mar 19 11:53:36 EST 2004

Jaap A. Haitsma wrote:

> if ((nodeLocalName == "TEXTAREA") ||
>     (nodeLocalName == "INPUT" && node.type == "text")) {

Ideally you would use node instanceof HTMLTextAreaElement (or 
HTMLInputElement) instead of checking the node's local name.

>     selection = 
> focusedWindow.__proto__.getSelection.call(focusedWindow).toString();

I wondered why you messed around with __proto__, but even 
nsContextMenu.js does it, sigh...

> selection = selection.toString();

It should already be a string by now :-P

More information about the Project_owners mailing list