1
2
3
4
5
6
7
8
9
10
11
      //  1. If there is just one text area, we use that.
      // 
      //  2. If there are multiple, we ask the web view to “select all”
      //     which goes to the active text area (hopefully) and then we
      //     check which of the text areas in the DOM actually changed.
      // 
      //     There is a problem if either a text area has no content (in
      //     which case select all makes no changes) or if everything is
      //     already selected. If only one text area is in the state of
      //     “select all would not affect it” and no text areas were
      //     changed, we assume the one with that state is the active.