X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdomiterator%2Fplugin.js;fp=_source%2Fplugins%2Fdomiterator%2Fplugin.js;h=dcb592dae089dec49092c68af06d421129ee72b7;hb=055b6b0792ce7dc53d47af606b367c04b927c2ab;hp=b12e3452c3d9caab165b37839581214ee7ab713e;hpb=66f4ae0bf0280ed56bf7c0f4ab175424dd1d47a0;p=ckeditor.git diff --git a/_source/plugins/domiterator/plugin.js b/_source/plugins/domiterator/plugin.js index b12e345..dcb592d 100644 --- a/_source/plugins/domiterator/plugin.js +++ b/_source/plugins/domiterator/plugin.js @@ -51,6 +51,10 @@ CKEDITOR.plugins.add( 'domiterator' ); if ( !this._.lastNode ) { range = this.range.clone(); + + // Shrink the range to exclude harmful "noises" (#4087, #4450, #5435). + range.shrink( CKEDITOR.NODE_ELEMENT, true ); + range.enlarge( this.forceBrBreak || !this.enlargeBr ? CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS : CKEDITOR.ENLARGE_BLOCK_CONTENTS ); @@ -212,26 +216,8 @@ CKEDITOR.plugins.add( 'domiterator' ); // We have found a block boundary. Let's close the range and move out of the // loop. - if ( ( closeRange || isLast ) && range ) - { - var boundaryNodes = range.getBoundaryNodes(), - startPath = new CKEDITOR.dom.elementPath( range.startContainer ); - - // Drop the range if it only contains bookmark nodes, and is - // not because of the original collapsed range. (#4087,#4450) - if ( boundaryNodes.startNode.getParent().equals( startPath.blockLimit ) - && isBookmark( boundaryNodes.startNode ) && isBookmark( boundaryNodes.endNode ) ) - { - range = null; - this._.nextNode = null; - } - else + if ( isLast || ( closeRange && range ) ) break; - } - - if ( isLast ) - break; - } // Now, based on the processed range, look for (or create) the block to be returned. @@ -245,7 +231,7 @@ CKEDITOR.plugins.add( 'domiterator' ); return null; } - startPath = new CKEDITOR.dom.elementPath( range.startContainer ); + var startPath = new CKEDITOR.dom.elementPath( range.startContainer ); var startBlockLimit = startPath.blockLimit, checkLimits = { div : 1, th : 1, td : 1 }; block = startPath.block;