[meta] Get rid of bogus and trailing BR nodes in editor
Categories
(Core :: DOM: Editor, defect, P2)
Tracking
()
People
(Reporter: peterv, Unassigned)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
(Keywords: meta, Whiteboard: h2review-noted)
Attachments
(1 obsolete file)
Reporter | ||
Comment 1•16 years ago
|
||
Comment 2•16 years ago
|
||
![]() |
||
Comment 3•16 years ago
|
||
![]() |
||
Comment 7•16 years ago
|
||
Comment 12•13 years ago
|
||
Comment 13•13 years ago
|
||
Comment 14•5 years ago
|
||
Hello. I recently filed a bug #1615852 about spurious <br>
and other inconsistencies. I am a bit worried about leaking the internal layout-fixing workarounds to the Javascript applications. I'm pretty sure that must create all sorts of issues unexpected both by the users and by the frontend developers.
I shared the following test code in the other bug:
<!DOCTYPE html>
<html>
<head>
<style>
#source { width: 10em; background-color: lightgreen; }
#target { margin-top: 1em; background-color: lightgrey; }
</style>
</head>
<body>
<div id="source" contenteditable="true">xxx</div>
<div id="target"></div>
<script>
source = document.getElementById("source");
target = document.getElementById("target");
function display() {
target.innerText = source.innerHTML;
}
source.addEventListener("input", display);
display();
</script>
</body>
</html>
The aforementioned workaround both has unwanted side effects and doesn't work reliably. Try the following steps and check if you're getting the same (often wrong) behavior as I do:
- Load the above document.
xxx
- Put the carret after
xxx
and hitBackspace
thrice.
<br>
(the workaround)
- Put back
xxx
.
xxx<br>
(looks good in my case but becomes xxx\n<br>
in Google Sheets)
- Hit
Enter
.
<div>xxx</div><div><br></div>
(does this make sense?)
- Hit
Backspace
.
<div>xxx</div>
(inconsistent, <br>
is lost now)
- Hit
Backspace
thrice.
<div><br></div>
(inconsistent, <br>
is now back but enclosed in divs)
- Hit
Backspace
.
`` (<br>
is now lost and the workaround failed completely, layout is of course broken)
- Type
xxx
.
xxx
(just for completeness, you are now back to the initial state)
Thus my conclusion that the workaround is both broken and has unexpected side effects.
Comment 15•5 years ago
|
||
Emilio, now with bug 1098151 fixed, what does it mean for this bug? I assume there is still some additional work needed?
Comment 16•5 years ago
|
||
Maybe? Do we insert <br>
for flex / grid / other layout modes? Does it matter for those?
But makoto or masayuki are the best people to address this. I'd probably wait a bit in case bug 1098151 causes any regression, anyhow.
Comment 17•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #16)
But makoto or masayuki are the best people to address this. I'd probably wait a bit in case bug 1098151 causes any regression, anyhow.
Comment 18•5 years ago
|
||
Empty block like normal <p>
element (at least) should keep having <br>
element for web-compat and backward compatibility, but we should remove it when the block becomes not-empty like the other browsers. I also hit this bug when I wrote a WPT a couple of the days ago...
Comment 19•5 years ago
|
||
Sigh, I hit this bug when I try to change somewhere in editor classes... I'll try to fix this first.
Updated•5 years ago
|
Comment 20•5 years ago
|
||
HTMLEditor
does not remove padding <br>
element for last empty line when
it becomes unnecessary.
This patch removes it when inserting some text into a text node and it's
followed by a padding <br> element.
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
bugherder |
Comment 23•5 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/67b2b97539bd was backed out due to the regression in bug 1636747.
This looks like a semi-meta bug, should we add [meta] to the title?
Comment 25•5 years ago
|
||
(In reply to Kagami :saschanaz from comment #24)
This looks like a semi-meta bug, should we add [meta] to the title?
Well, this page is too long to discuss something. So, it's fine to make this a meta bug and working on blocker bugs.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 26•5 years ago
|
||
Resetting assignee which I don't work on in this several months.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 27•8 months ago
|
||
In most cases, the fix of bug 1923251 fixes this bug. However, we still use bogus line breaks to make the last collapsible white-space visible before a block boundary. For fixing the bug, we need to use
for the white-space. However, for doing that we should use the new WIP white-space normalizer (bug 1658699).
Updated•7 months ago
|
Description
•