User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0 Build ID: 20120312181643 Steps to reproduce: I have text in a textarea that is delete and then restored using Ctrl+z. When the text is restored an mysterious \n is added to the end of the text. Here is an example of the the bug: http://jsfiddle.net/dwaddell/S9mAv/18/ I have tested this in IE and Chorme and it works properly. Actual results: If the text was "abc" it will end up being "abc\n". Expected results: The text should be restored as "abc".
Can you test this with a current Firefox Nightly build from nightly.mozilla.org and see if it still happens? For me in Nightly, if I follow the steps in that jsfiddle, I see the following things logged to the console, and there is no \n in the textarea: [23:52:45.290] 9 Delete Me @ http://fiddle.jshell.net/dwaddell/S9mAv/18/show/:33 -- [23:53:01.114] 0 @ http://fiddle.jshell.net/dwaddell/S9mAv/18/show/:41 -- [23:53:13.893] 11 Delete Me @ http://fiddle.jshell.net/dwaddell/S9mAv/18/show/:41
I can reproduce on a nightly, here's a jquery-less testcase: http://jsfiddle.net/S9mAv/20/ Note also bug 471319 and bug 523441.
Regression window(m-c) Works: http://hg.mozilla.org/mozilla-central/rev/145c98d55ae1 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110814 Firefox/8.0a1 ID:20110814030749 Fails: http://hg.mozilla.org/mozilla-central/rev/2de3cff973b2 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110814 Firefox/8.0a1 ID:20110814044816 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=145c98d55ae1&tochange=2de3cff973b2 Regression window(m-i) Works: http://hg.mozilla.org/integration/mozilla-inbound/rev/56eaf58dc5fb Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110812 Firefox/8.0a1 ID:20110812113455 Fails: http://hg.mozilla.org/integration/mozilla-inbound/rev/437f3eb67c18 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110812 Firefox/8.0a1 ID:20110812125630 Pushlog: http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=56eaf58dc5fb&tochange=437f3eb67c18 Suspected: 437f3eb67c18 Graeme McCutcheon — Bug 483651 - Trailing <br> node not removed when it should be; r=ehsan
The cause of this bug is that nsTextEditorState::mCachedValue contains the value with the trailing BR. The value that the underlying editor has is actually correct.
Created attachment 614715 [details] [diff] [review] v1 Essentially the opposite of bug 483651. Post-undo, the trailing BR does not get the mozBR attribute re-instated, so it gets interpreted as a newline. Green on try, and fixes another test that had been forced to rely on the broken behaviour.
Comment on attachment 614715 [details] [diff] [review] v1 Zero risk for mobile as the undo functionality does not exist there.
Comment on attachment 614715 [details] [diff] [review] v1 [triage comment] low/no risk to mobile.
I changed the test to waitForFocus, per comment 7: https://hg.mozilla.org/integration/mozilla-inbound/rev/304cd5d5124b The others should be taken care of Ms2ger's patch in bug 747346