Ticket #6946: 6946.patch

File 6946.patch, 1.3 KB (added by Garry Yao, 8 years ago)
  • _source/core/htmlparser/fragment.js

     
    4848                        CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ),
    4949                listBlocks = CKEDITOR.dtd.$list, listItems = CKEDITOR.dtd.$listItem;
    5050
     51        // Dtd of the fragment element, basically it accept anything except for intermediate structure, e.g. orphan <li>.
     52        var rootDtd = CKEDITOR.tools.extend( {}, { html: 1}, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head );
     53
    5154        /**
    5255         * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string.
    5356         * @param {String} fragmentHtml The HTML to be parsed, filling the fragment.
     
    203206
    204207                        var currentName = currentNode.name;
    205208
    206                         var currentDtd = currentName
    207                                 && ( CKEDITOR.dtd[ currentName ]
    208                                         || ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) );
     209                        var currentDtd = currentName ? ( CKEDITOR.dtd[ currentName ]
     210                                        || ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) )
     211                                        : rootDtd ;
    209212
    210213                        // If the element cannot be child of the current element.
    211214                        if ( currentDtd   // Fragment could receive any elements.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy