When typing a post in WordPress 2.2.1 with visual editor activated, line breaks appear in the editor, but are stripped out when saving the post or switching to "Code View". This doesn't occur when setting WebKit's UA to Mozilla.
Bug cross posted to : http://trac.wordpress.org/ticket/4521
Behaviour changes to be *almost* correct when using the firefox UA. It looks like the switch between code and visual mode is stripping out <p> and <br> elements for some reason. When using firefox UA it looked like it was hiding <br> and <p> in code editing mode, and reinserting them (or something) in visual mode, so something is that logic is probably the cause of the woes.
Oliver Hunt's comment makes sense since that's the normal behavior in Firefox : When switching to code editing mode, there are no <p> and <br> (but actual new lines) But when saving the post, there should <p> and <br>
Should this bug block Bug 6627?
David Kilzer : In my opinion, it should. It prevents the WP editor from being usable.
> Should this bug block Bug 6627? TinyMCE's advanced editor's "Show Source" feature doesn't have this problem, so no, since this seems to be specific to WordPress. Nevertheless, this bug is real serious, and so we should try to get it addressed asap.
<rdar://problem/5368629> WordPress: Editor strips paragraph breaks
Looks like the textarea that WordPress uses to submit contains (as children) text nodes and brs: TEXTAREA 0x1779c6c0 CLASS=mceEditor STYLE=display: none; #text 0x187be120 "foo" BR 0x187be150 BR 0x187be1c0 #text 0x187be260 "bar" BR 0x187be290 BR 0x187be300 #text 0x187be3a0 "baz" But the value() of the textarea is "foobarbaz". I made this reduction: <script> function foo() { textarea = document.getElementById("textarea"); textarea.appendChild(document.createTextNode("foo")); textarea.appendChild(document.createElement("br")); textarea.appendChild(document.createTextNode("bar")); } function bar() { alert(textarea.value); } </script> <textarea id="textarea"></textarea> <input type="button" onclick="foo();"> <input type="button" onclick="bar();"> And it behaves the same way in FF. I don't think this is the right way to submit the content of the editable region. This seems like a WordPress bug.
Filed a TinyMCE bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1765800&group_id=103281&atid=635682
Moving to Evangelism per Comment #8 and Comment #9.
Apparently this is fixed in WordPress 2.5, which is set to be released shortly: http://trac.wordpress.org/ticket/4521 http://blog.wired.com/monkeybites/2008/03/catch-a-sneak-p.html
Looks like 2.5 was deployed at wordpress.com. I can no longer reproduce this.