- Added the selection listener only to documents loaded in Tab (is consistent with other modules like PageMod)
- Avoid to handle detached selections
(cherry picked from commit bf36170f13a10ad8f11802fbc35ddbf2abf82f3f)