X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fhtmlparser%2Ffragment.js;h=f94f4e917d242c61b6e99e942495f852abae6868;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=244e298320d63278cf09f939e704dd5a376b74ce;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/core/htmlparser/fragment.js b/_source/core/htmlparser/fragment.js index 244e298..f94f4e9 100644 --- a/_source/core/htmlparser/fragment.js +++ b/_source/core/htmlparser/fragment.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -108,9 +108,9 @@ CKEDITOR.htmlParser.fragment = function() } } - function sendPendingBRs() + function sendPendingBRs( brsToIgnore ) { - while ( pendingBRs.length ) + while ( pendingBRs.length - ( brsToIgnore || 0 ) > 0 ) currentNode.add( pendingBRs.shift() ); } @@ -118,20 +118,19 @@ CKEDITOR.htmlParser.fragment = function() { target = target || currentNode || fragment; - // If the target is the fragment and this element can't go inside + // If the target is the fragment and this inline element can't go inside // body (if fixForBody). if ( fixForBody && !target.type ) { var elementName, realElementName; if ( element.attributes && ( realElementName = - element.attributes[ '_cke_real_element_type' ] ) ) + element.attributes[ 'data-cke-real-element-type' ] ) ) elementName = realElementName; else elementName = element.name; - if ( elementName - && !( elementName in CKEDITOR.dtd.$body ) - && !( elementName in CKEDITOR.dtd.$nonBodyContent ) ) + + if ( elementName && elementName in CKEDITOR.dtd.$inline ) { var savedCurrent = currentNode; @@ -237,6 +236,12 @@ CKEDITOR.htmlParser.fragment = function() { addElement( currentNode, currentNode.parent ); } + else if ( tagName in CKEDITOR.dtd.$listItem ) + { + parser.onTagOpen( 'ul', {} ); + addPoint = currentNode; + reApply = true; + } else { if ( nonBreakingBlocks[ currentName ] ) @@ -386,13 +391,16 @@ CKEDITOR.htmlParser.fragment = function() parser.onComment = function( comment ) { + sendPendingBRs(); + checkPending(); currentNode.add( new CKEDITOR.htmlParser.comment( comment ) ); }; // Parse it. parser.parse( fragmentHtml ); - sendPendingBRs(); + // Send all pending BRs except one, which we consider a unwanted bogus. (#5293) + sendPendingBRs( !CKEDITOR.env.ie && 1 ); // Close all pending nodes. while ( currentNode.type )