getHtmlFromRange should use CodeMirror's version of truth

resolves https://github.com/firebase/firepad/issues/117

also add a spec for this