I couldn't get it to work in Chrome ("keyCode of undefined" errors). This is similar to something I wrote for Automattic recently.<p>I was pretty pleased with how I tackled annotations across block level elements. Essentially you find your range's start and end containers, and if they match you can just range.surroundContents on them, but otherwise you surroundContents multiple times, once for the start container to its end, once for the end container, from its start until the end of the range, and then for every block element in the middle. Fun stuff.