innerText-spec
innerText-spec copied to clipboard
suggested tweak for explicit newline
As rendered, an explicit newline at the end of a block collapses with a "required newline". Consider
<div>line1<span>
</span></div><div>line2</div>
This is rendered (in my experience) with no blank line in between.
If you want to model this, perhaps tweak the specification a bit. For example replace item 5 by:
For each remaining run of consecutive "required line break count" items calculate the maximum of the values in the "required line break count" items. Subtract one if the previous item is a string that ends in a newline. Replace the run with a string consisting of that many newline characters.
or by:
Replace each remaining run of consecutive "required line break count" items with a string consisting of as many newline characters as the maximum of the values in the "required line break count" items, subtracted by one if the previous item is a string that ends in a newline.