jquery.textSelection: Don't throw errors on empty collections

All jQuery functions just do nothing or return "empty" values when
called on an empty collection (e.g. `$()`), the ones defined in this
module should behave in the same way.

This came to light when a change in WikiEditor combined with lousy
coding caused this code path to be called, breaking various gadgets
and extensions like SemanticForms.

Bug: 64289
Change-Id: Ib97f47ef1d66420682bd429c9c12e66c3392e77d
(cherry picked from commit 2828669dd40f63f60c2391b6d5ee30a3e255f3db)
Merge "jquery.textSelection: Don't throw errors on empty collections" into wmf/1.24wmf2