Open Bug 205946 Opened 18 years ago Updated 3 years ago
Get rid of annoying useless trailing <br> generated by editor in text and paragraphs
Test case #1 : 1. launch composer 2. type aaaaaa 3. CR 4. type bbbbbb 5. switch to source view Expected result: aaaaaa<br> bbbbbb Actual result: aaaaaa<br> bbbbbb<br> Test case #2 1. launch composer 2. select Format > Paragraph 3. type aaaaaa 4. CR 5. type bbbbbb 6. switch to source view Expected result: <p>aaaaaa<br> bbbbbb</p> Actual result: <p>aaaaaa<br> bbbbbb<br> </p>
Comment on attachment 123509 [details] [diff] [review] fix #1 jfrancis, can you r= please ? peter, can you sr= please ?
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla1.5alpha
previous patch was buggy, getting rid of the <br> even in the case described in the comment in http://lxr.mozilla.org/seamonkey/source/editor/libeditor/html/nsWSRunObject.cpp#2064
Attachment #123509 - Attachment is obsolete: true
Comment on attachment 124263 [details] [diff] [review] fix #2 Joe, please, can you r= this patch ?
Attachment #124263 - Flags: review?(jfrancis)
Please describe to me exactly what these two changes do. They can't fix this bug, since this bug is not a but at all, as per the comment in http://lxr.mozilla.org/seamonkey/source/editor/libeditor/html/nsWSRunObject.cpp#2064
This may not strictly be a bug according to the comments, but it's definitely a bit of a kludge designed to support an antiquated typographical technique, and looks buggy when you view the code generated by Composer. Isn't there a cleaner way to achieve this? Rather than sprinkling a lot of unnecessary <br> tags throughout every piece of generated code just because some users like two spaces at the end of sentences. Currently it's a case of swapping one bug for another, where both really need to be resolved.
Joe, the patch (a) removes a trailing non visible <br> if the last char of the preceeding text node is not a white space (b) removed the trailing <br> in a paragraph when enter is pressed twice.
I downloaded 2003-may-27 build. Thanks for fix But:- 1) Still I get a <br> inside <body> of a new document. -------- new html document in composer begins ----- <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title></title> </head> <body style="background-image: url(about:blank);"> <br> </body> </html> -------- new html document in composer ends ----- 2) A <br> will be created in a empty tag <table><tr><td></td></tr></table> will be changed as <table> <tbody> <tr> <td><br> </td> </tr> </tbody> </table>
read comment http://lxr.mozilla.org/seamonkey/source/editor/libeditor/html/nsWSRunObject.cpp#2064 It seems extra <br> is not a bug, but a feature What if user dont want 2 spaces at the end of a sentence. Cant we have a preference setting to enable disable 2 spaces and extra <br> Also why <br> cant we have <br/> instead
Comment on attachment 124263 [details] [diff] [review] fix #2 this is buggy and obsolete
Attachment #124263 - Attachment is obsolete: true
<br /> is preferable per recommendations for compatibility with existing user agents in W3C XHTML spec.
Let me clarify my earlier post. It may have been misunderstood: <br /> is better than <br/> per recommendations cited above. However, it is best to avoid the extra <br/> elements in the first place. In fact, <p>...</p> is often more appropriate than <br />.
*** Bug 255839 has been marked as a duplicate of this bug. ***
Assignee: daniel → nobody
Target Milestone: mozilla1.5alpha → ---
Is there a workaround, please? I need to obtain the exact content of contentEditable (white-space: pre-wrap) on input and have no idea how to identify the trailing <br> as desired or not (to remove it potentially). Inspiration: Take innerHTML, remove trailing <br> and put it to an element of the exact size and formatting. If the copy is NOT lower, the original <br> should be removed. In my use case this might be reliable, but the performance could be a problem.
Moving to p3 because no activity for at least 1 year(s). See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Maybe the requirement can be even closed -- in FF 60, bug 1430551 was implemented and <br> should be replaced by <div> now.
You need to log in before you can comment on or make changes to this bug.