[selection-api] support selection.containsNode(obj, true) (#39)

Could you please implement selection.containsNode(), as I need to use it or to use something like it for my GoogleTrans gadget, which is on en.wikipedia.org.

This gadget is loaded by 23,000 ids on the English wikipedia.

I have something called selection translation.

You

1) select small amounts of text (> 500 characters)
2) put the cursor within the selected text (to avoid annoying popups when you don't want them)
3) hold the shift key down.

When you do these three things, then a popup happens with the Google translation of the selected text.

In order to know whether the cursor is in the selected text object I use, among other things, the selection.containsNode()

A small clip of the code is below:

   /*
           if(userSelection.containsNode(children[i],false))
            SCselection[i] = true;
           else
           */

           if(!SCbIsIE11 && userSelection.containsNode(children[i],true))
           {

              SCselectionarray[i] = new Array();
              SCselectionstart[i] = -1;
              SCselectionend[i] = -1;

              SCAreWordsInSelection(userSelection,SCselectionarray[i],
              children[i],i);

              SCselection[i] = false;
           }
           else
           {

              SCselectionarray[i] = new Array();
              SCselection[i] = false;
              SCselectionstart[i] = -1;
              SCselectionend[i] = -1;
           }

I want to tell you that I never could get userSelection.containsNode(children[i], false) to work.  Firefox (and later IE9 and IE10) only worked for userSelection.containsNode(children[i], true)

However, both IE9 and IE10 supported this call.  Would you please support the call for IE11, as least in the
userSelection.containsNode(children[i], true) mode.  It is very helpful to me.

Otherwise, I cannot support knowing whether the cursor is over the current selection.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/39

Received on Friday, 26 December 2014 20:22:05 UTC