innerHTML reports a superfluous HTMLBRElement after editing a heading with contenteditable set to true in FF4 (Bug 656626)

Description of the BUG

When you edit a heading that has its contenteditable attribute set to true and add spaces at its end, an extra HTMLBRElement is reported by innerHTML after the last space. Once it is added, there is no way to get rid of it anymore. When you add characters instead of spaces, no HTMLBRElement is added.

How to test the BUG?

  1. Click "show h1.innerHTML": this alerts "contenteditable heading"
  2. Add one space at the end of "contenteditable heading"
  3. Click "show h1.innerHTML": this alerts "contenteditable heading <br>"
  4. Remove the previously added space at the end of "contenteditable heading "
  5. Click "show h1.innerHTML": this alerts "contenteditable heading<br>"

contenteditable heading