Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13601 closed Bug (invalid)

createFromHtml

Reported by: Pablo Tomas Borda Owned by:
Priority: Normal Milestone:
Component: General Version: 4.5.1
Keywords: Cc:

Description

Hello I run the following

new CKEDITOR.dom.element.createFromHtml("The account <span id=\"generated_-1381018772\"><link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/menu.css?version=51\"><div class=\"cssmenu\" contenteditable=\"false\"><ul style=\"background:#3A8437!important;\"><li class=\"has-sub\"><a href=\"#\"><span><label style=\"color:white!important;\">brazil</label></span></a><ul><li class=\"last\"><a href=\"#\"><span>check_everest_service_sheet</span></a></li></ul></li></ul></div></span>").$;

and I get:

<TextNode textContent="The account ">

When I expect to get the full markup, why could that be?

Regards

Pablo

Change History (2)

comment:1 Changed 4 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed

The HTML you try to turn into an element is absolutely invalid. Span cannot contains a div and a list.

comment:2 Changed 4 years ago by Pablo Tomas Borda

Do you know some way to make the createFromHTML not so strict ?

for example I realize if I use $.parseHTML I get the dom content from it anyway.. there are some things I cannot avoid to make the code be valid for createFromHtml

Also I'm not successful to build a CKEditor dom element. Basically what I want to do is to replace one paragraph by another.. I cant find very good examples, and if I update the data directly by normal string replace the editor shows nothing... I also do not want to you setData() or getData() because it will have to override the full content of the editor, which could turn in a bad experience...

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy