selected
selected ([doc[, type]])
This function returns 1 (True) if there is a selection in the current window. Note that this is faster than testing length($selection).
• doc — Specifies the identifier of the document tree to query. If omitted or 0, the current document is used.
• type — A qualifier defining a particular type of selection:
◦ 1 — Return true if this is a text selection.
◦ 2 — Return true if this is a table selection.
◦ 3 — Return true if this is either a text or table selection.