#8905 closed Bug (invalid)
CKEDITOR.htmlWriter giving unexpected results
Reported by: | Lynne Kues | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.6.2 |
Keywords: | IBM | Cc: |
Description (last modified by )
var writer = new CKEDITOR.htmlWriter(); var contents = '<div>' + '<p id="_1334328943223">' + '<span class="showContent com-ibm-rdm-editor-EmbeddedResourceDecorator embeddedContentLoadRequired">' + '<a id="_1334328943227" class="embedded" href="https://bmweb.com:9443/rm/resources/_hi0cpYPdEeGKpePNjL95TQ">' + '<u> </u>' + '</a>' + '</span>' + '</p>' + '<span> </span>' + '<p id="_1334328943224"/>' + '<p id="_1334328943225">' + '<span class="showContent com-ibm-rdm-editor-EmbeddedResourceDecorator embeddedContentLoadRequired">' + '<a id="_1334328943228" class="embedded" href="https://bmweb.com:9443/rm/resources/_hi0cpYPdEeGKpePNjLZZZ">' + '<u> </u>' + '</a>' + '</span>' + '</p>' + '<span> </span>' + '<p id="_1334328943226"/>' + '</div>'; var frag = CKEDITOR.htmlParser.fragment.fromHtml(contents); frag.writeHtml(writer); console.log("CONTENTS " + writer.getHtml());
Executing the above gives the following result, which is unexpected as it removes data (seen on FF10 and IE9:
CONTENTS <div> <p id="_1334328943223"> </p> <p id="_1334328943224"> </p> <p id="_1334328943225"> </p> <p id="_1334328943226"> </p> </div>
Change History (3)
comment:1 Changed 13 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
To workaround this problem simply add in your most nested inline element.
Instead of '<u> </u>'
please use <u> </u>
This is not only an issue with htmlWriter but how CKEditor works - to test it simply insert
<span> </span> <span> </span>
and switch modes and you will see that first span will be removed.
It's not a bug - the inline elements (those are stripped) contains nothing but whitespace which is at the beginning of the block thus are not visible from rendered HTML, those contents are considered as garbage thus is removed when parsing.