Added more robust handling for selecting the focused element when detecting a trigger
Added a fix for Firefox’s handling of trailing whitespace
Added fix for Firefox—the body element was being selected