Hi,

I'm trying to expand upon the HtmlArea example from the demo browser so
that when the user has the cursor in a link and clicks the link button,
it extracts the existing link and displays it in the text box, and then
replaces the old one with the new one.  This code:

      var test = this.getRange();
      if (test.startContainer.parentNode.nodeName == "A") {
        var textField = new
qx.ui.form.TextField(test.startContainer.parentNode.attributes[0].firstChild.data);
      } else {
        var textField = new qx.ui.form.TextField("http://";);
      }

works some of the time, but is extremely brittle/erratic.  When one
double-clicks a link to select a word, the <span> element containing the
link is returned as startContainer.  If one click-drags to select some
of the letters in the link, the <a> element is returned as
startContainer.  If one click-drags to select all of the letters,
sometimes the <a> element is returned, and sometimes the <span>
element.  It seems to differ based on whether the mouse drags a few
pixels past the edge of the first letter or not.

Does anyone have any ideas on how to deal with this frustratingly
inconsistent behavior, or have a better way to detect a link under the
cursor or in selected text?

I've also noticed that if one selects and deletes the linked text, the
link element remains with no content, but although annoying, that is
easier to handle as I can strip the tags on the server side pretty easily.

Thanks,
Greg

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to