guardian / scribe

DEPRECATED: A rich text editor framework for the web platform
http://guardian.github.io/scribe/
Apache License 2.0
3.5k stars 245 forks source link

Chrome: an OL, converted from a UL, gets wrapped in a span #342

Open saranrapjs opened 9 years ago

saranrapjs commented 9 years ago

As distinct from the known Chrome list + span issue, I believe there's yet another Chrome-specific span line-height + list element "inconsistency". When converting a <ul/> to an <ol/>, on a page where a line-height has been defined on the body, the <ol/> that results will be wrapped in a bogus <span> with a line-height. It seems that this only happens when the list element is not the only element in the contenteditable.

So this:

<p>1</p>
<ul><li>23</li></ul>

Becomes:

<p>1</p>
<span style="line-height: 2;"><ol><li><span style="line-height: 2;">23</span><br></li></ol></span>

Here's an isolated test case with a vanilla document.execCommand: http://jsbin.com/rawoqasako/1/edit?html,css,js,output

When this scenario occurs in the Scribe editor, the enforce-p-elements plugin removes the wrapping span, but you end up with two unasked-for paragraphs:

<p>1</p>
<p><span style="line-height: 2;"><br></span></p>
<ol><li>23</li></ol>
<p><br></p>