While editing, we need to consider whether removing a <br> has any effect on layout to determine whether its extraneous. This new condition finds most cases for extraneous <br>s inside block elements.
18 lines
397 B
Text
18 lines
397 B
Text
--- a ---
|
||
Before: foobar
|
||
After: fobar
|
||
--- b ---
|
||
Before: foo👩🏼❤️👨🏻bar
|
||
After: foobar
|
||
--- c ---
|
||
Before: foo<div contenteditable="">bar</div>
|
||
After: foobar
|
||
--- d ---
|
||
Before: foo<br><br><div>bar<br>baz</div>
|
||
After: foo<br><div>bar<br>baz</div>
|
||
--- e ---
|
||
Before: <p>foo</p><br><p>bar</p>
|
||
After: <p>foo</p><p>bar</p>
|
||
--- f ---
|
||
Before: <p><span>abc</span><br></p>
|
||
After: <p><br></p>
|