#11719 closed Bug (invalid)
[IE8] CKEDITOR.dom.element#setHtml() will strips new lines
Reported by: | Marek Lewandowski | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description (last modified by )
Seems that setHtml strips new lines for IE8.
Here's js code to reproduce the issue:
test_setHtmlNewLines: function() { var elem = new CKEDITOR.dom.element( 'pre' ), expectedCode = "foo\n\nbar"; elem.setHtml( expectedCode ); assert.areSame( expectedCode, elem.getHtml() ); },
It does not work only for pre element, i've tested it with div, p as well.
Pushed TC to tests in t/11719.
Change History (7)
comment:1 Changed 11 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 11 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 11 years ago by
comment:4 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
You're correct that it is IE8 internal issue. I've checked also elem.innerText = 'foo\n\nbar'; and it does not work either. That might be tricky, anyway it makes this ticket invalid.
comment:5 Changed 11 years ago by
elem.innerText = 'foo\n\nbar'; and it does not work either.
Did you mean that comparation doesn't work only? I'm asking because using this method there were visible line breaks in editor.
comment:6 Changed 11 years ago by
@Marek: this is also an answer why did you have problems in the code snippet plugin. I knew that there was some difference in new lines in <pre> in modern browsers and IE8.
comment:7 Changed 11 years ago by
So, to sum things up, i did test one again and it turns out that:
setting pre.innerText = "foo\nbar"
will result with following innerHTML:
<pre>foo<br>bar</pre>
setting pre.innerHTML = "foo\nbar"
will result with following innerHTML:
<pre>foo bar</pre>
(note it's a space, char code 32 dec, 0x20 hex)
With these tests i've used native dom properties. All other IEs works as expected in that regard.
Here are my results:
Native:
Editor:
I may be incorrect but changing method to setText (for me \n is text not HTML) or using BR's instead of \n will do the trick.