[webkit-help] how to get the word under the mouse?

baizhenxuan baizhenxuan at gmail.com
Wed Feb 24 00:20:12 PST 2010


Hi,
i want to get the word under the mouse through javascript,but i cannot 
find any helpful api.
in firefox, mouseEvent has property rangeParent and rangeOffset that 
help me to get the word under the mouse, but in webkit, i can only find 
which node under the mouse ,cannot find any position information inside 
the text node. for example, in the following html, i can only find the 
mouse stay on a HTMLDivElement and it's content is " Ap The ...", what i 
want is which word the mouse stay on.
<div>
AP The measure cleared a key hurdle on Monday when the Senate's newest 
Republican
</div>


  Best Regards,
  baizhenxuan


More information about the webkit-help mailing list