Wrap extentions to document and window inside sections.
Make the user agent update the selection's direction as well as the start and the end.
Also added the definitions of selectstart and selectionchange events
in order to resolve https://www.w3.org/Bugs/Public/show_bug.cgi?id=13952.