Closed sleemanj closed 4 years ago
ejucovy commented:
This bug exists using Chrome 31.0.1650.63.
It does not exist using Firefox 26.0 -- in that browser, the behavior is exactly as it should be, per the last paragraph of the ticket. (Resulting HTML is
<ul><li><h2>Foo</h2></li></ul>
in Firefox.)
This must be a chrome bug, confirm it still exists in Chrome 65, but not in IE 11 or FF 58
The format (heading) is done by the browser's execCommand. Perhaps your ContentEditable plugin could help, but that seems like a lot of code to solve this problem.
In Xinha.prototype._comboSelected
case "formatblock": // Mozilla inserts an empty tag (<>) if no parameter is passed if ( !value ) { this.updateToolbar(); break; } if( !Xinha.is_gecko || value !== 'blockquote' ) { value = "<" + value + ">"; } this.execCommand(txt, false, value); break;
I think that given the rarity of wanting to put a header in a list item, wontfix.
wontfix
new
to closed
To reproduce:
<ul><li>Foo</li></ul>
<h1>
. (HTML:<h1><ul><li>Foo</li></ul></h1>
<h2>
instead.The HTML will now be:
<h1><h2><ul><li>Foo</li></ul></h2></h1>
The expected behavior would be to replace the H1 tag with an H2 tag.
That said, I think there's also a bug earlier in these steps: the
<h1>
should be wrapped around the contents of the current<li>
, rather than wrapping the entire<ul>
. This is (slightly) more likely to be the user's intention, and http://stackoverflow.com/a/5014827/689985 suggests that the latter is valid HTML while the former is invalid.Reported by ejucovy, migrated from http://trac.xinha.org/ticket/1615