Skip to content
Permalink
Browse files

Merge branch 't/12964' into major

  • Loading branch information...
pjasiun committed Mar 2, 2015
2 parents 015c43d + d8b3a7a commit fb71fc8d2cc4b3ed27e420e9974a3c088ca83d2f
@@ -57,10 +57,7 @@ var config = {
'tests/core/editable/keystrokes/delbackspacequirks/collapsed#test backspace #9': 'env.safari',
'tests/core/editable/keystrokes/delbackspacequirks/collapsed#test backspace, merge #2': 'env.safari',
'tests/core/editable/keystrokes/delbackspacequirks/collapsed#test backspace, merge #3': 'env.safari',
'tests/core/editable/keystrokes/delbackspacequirks/collapsed#test backspace, merge #8': 'env.safari',

// IE8-10 (#12964)
'tests/core/editable/getextractselectedhtml#test extractHtmlFromRange: tables #20': 'env.ie && env.version < 11'
'tests/core/editable/keystrokes/delbackspacequirks/collapsed#test backspace, merge #8': 'env.safari'
}
},

@@ -2735,9 +2735,21 @@
editableRange,
walker = new CKEDITOR.dom.walker( range ),
startCell = range.startPath().contains( tableEditable ),
endCell = range.endPath().contains( tableEditable );
endCell = range.endPath().contains( tableEditable ),
database = {};

walker.guard = function( node, leaving ) {
// Guard may be executed on some node boundaries multiple times,
// what results in creating more than one range for each selected cell. (#12964)
if ( node.type == CKEDITOR.NODE_ELEMENT ) {
var key = 'visited_' + ( leaving ? 'out' : 'in' );
if ( node.getCustomData( key ) ) {
return;
}

CKEDITOR.dom.element.setMarker( database, node, key, 1 );
}

// Handle partial selection in a cell in which the range starts:
// <td><p>x{xx</p></td>...
// will store:
@@ -2771,6 +2783,9 @@

walker.lastForward();

// Clear all markers so next extraction will not be affected by this one.
CKEDITOR.dom.element.clearAllMarkers( database );

return contentsRanges;

function checkRemoveCellContents( node ) {
@@ -1442,6 +1442,11 @@
fixZWS = ( 'fixZWS' in options ) ? options.fixZWS : true,
fixNbsp = ( 'fixNbsp' in options ) ? options.fixNbsp : true;

// On IE8- we need to get rid of expando attributes.
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) {
innerHtml = innerHtml.replace( / data-cke-expando="[^"]*"/g, '' );
}

if ( options.compareSelection ) {
innerHtml = innerHtml.replace( selectionMarkers, '<!--cke-range-marker-$1-->' );
}
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit */
/* bender-tags: editor,unit,range */

( function() {
'use strict';
@@ -24,15 +24,6 @@
getWithHtml = bender.tools.range.getWithHtml,
img_src = '%BASE_PATH%_assets/img.gif';

var tests = {
init: function() {
this.editables = {};

for ( var e in this.editors )
this.editables[ e ] = this.editors[ e ].editable();
}
};

// <DEV>
// var playground = CKEDITOR.document.createElement( 'dl' );
// playground.on( 'paste', function( e ) {
@@ -110,6 +101,28 @@
// output HTML | @ | like compareInnerHtml (accept) | like compareInnerHtml (we use it for uncertain cases)
// | @! | like compareInnerHtml (expect) | like compareInnerHtml (we use it for empty blocks)

var tests = {
init: function() {
this.editables = {};

for ( var e in this.editors )
this.editables[ e ] = this.editors[ e ].editable();
},

'test node markers are cleared': function() {
var html = decodeInputFillers( '<table><tbody><tr><td>a{b</td><td>c}d</td></tr></tbody></table>' ),
expected = '<table><tbody><tr><td>b</td><td>c</td></tr></tbody></table>',
editable = this.editables.inline,
range = setWithHtml( editable, html );

var docFragment = editable.extractHtmlFromRange( range );

assert.isInnerHtmlMatching( expected, docFragment.getHtml(), compareInnerHtmlOptions, 'Selected HTML' );
assert.isNull( editable.findOne( 'tr' ).getChild( 0 ).getCustomData( 'visited_out' ), '1st cell should not have a marker' );
assert.isNull( editable.findOne( 'tr' ).getChild( 1 ).getCustomData( 'visited_in' ), '2nd cell should not have a marker' );
}
};

addTests( {
'block': [
[ '<p>{a}</p>', 'a', '<p>[]@!</p>' ],
@@ -154,6 +154,16 @@
htmlTools.compareInnerHtml( 'a', 'a', opts );

assert.areSame( strOpts, JSON.stringify( opts ), 'options object has not been modified' );
},

'test on IE8 expando attributes are removed': function() {
if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 8 ) {
assert.ignore();
}

assert.isTrue( htmlTools.compareInnerHtml(
'<p>foo<i bar="2" foo="1">bar</i></p>',
'<p data-cke-expando="123ok">foo<i foo="1" data-cke-expando="" bar="2">bar</i></p>' ) );
}
} );
} )();

0 comments on commit fb71fc8

Please sign in to comment.
You can’t perform that action at this time.