2

I am writing an addon which needs to do capture the no of times someone has highlighted any text on a webpage. Is there any way I can listen to this event?

Thanks, Kapil

Kapil
  • 572
  • 1
  • 5
  • 23

2 Answers2

4

There is not a particular event for this. But you can listen to the mouseup event and check whether the selection returned by window.getSelection() is not empty and/or whether it differs from the previous selection.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
2

You could add a selection listener. The Source window (viewSource.js) does this so that it can keep the row and column number up-to-date.

Neil
  • 54,642
  • 8
  • 60
  • 72