Skip to content

Commit

Permalink
Fix for bug #31: Sometimes Mozilla gives a bad focused element, resul…
Browse files Browse the repository at this point in the history
…ting in a lost email.
  • Loading branch information
adam-p committed Oct 4, 2012
1 parent 2a26a94 commit 8cf8f2a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/markdown-here.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ function findFocusedElem(document) {
focusedElem = focusedElem.contentDocument.activeElement;
}

// There's a bug in Firefox/Thunderbird that we need to work around. For
// details see https://github.com/adam-p/markdown-here/issues/31
// The short version: Sometimes we'll get the <html> element instead of <body>.
if (focusedElem instanceof document.defaultView.HTMLHtmlElement) {
focusedElem = focusedElem.ownerDocument.body;
}

return focusedElem;
}

Expand Down

0 comments on commit 8cf8f2a

Please sign in to comment.