| 243 | | var $range = document.body.createTextRange(); |
| 244 | | $range.moveToElementText( container.$ ); |
| | 243 | // We need to record & reset the scroll position because if we focus on |
| | 244 | // the document.body the window will scroll to the top. |
| | 245 | var $range = document.body.createTextRange(), |
| | 246 | horizontalScroll = document.documentElement.scrollLeft, |
| | 247 | verticalScroll = document.documentElement.scrollTop; |
| | 248 | try |
| | 249 | { |
| | 250 | // This will fail if document.body is not a parentNode of container.$ |
| | 251 | $range.moveToElementText( container.$ ); |
| | 252 | } |
| | 253 | catch ( e ) |
| | 254 | { |
| | 255 | $range.moveToElementText( document.body ); |
| | 256 | } |