Rangy is a cross-browser JavaScript range and selection library.
Rangy also comes with optional modules, each of which comes in a separate .js file.
Current modules are:
Website Demo