Skip to content
Permalink
Browse files

Merge branch 't/14667c'.

  • Loading branch information...
Comandeer committed Jun 22, 2016
2 parents e956247 + a87f5cb commit b997321303c4e8f4ca14e4553e95d1bc87e63358
@@ -5,6 +5,7 @@ CKEditor 4 Changelog

Fixed Issues:

* [#14667](http://dev.ckeditor.com/ticket/14667): [IE] Fixed: Removing background color from selected text removes background color from the whole paragraph.
* [#14252](http://dev.ckeditor.com/ticket/14252): Fixed: Styles dropdown doesn't always reflect the current style of the text line in Internet Explorer.
* [#13929](http://dev.ckeditor.com/ticket/13929): Fixed: Errors in console on IE11 with compatibility mode in manual test for [#13867](http://dev.ckeditor.com/ticket/13867).
* [#14275](http://dev.ckeditor.com/ticket/14275): [IE9+] Fixed: `onerror` and `onload` not used in browsers it could have been when loading scripts dynamically.
@@ -368,13 +368,36 @@ CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatab
range.setEndAfter( parent );

// Extract it.
var docFrag = range.extractContents( false, cloneId || false );
var docFrag = range.extractContents( false, cloneId || false ),
tmpElement,
current;

// Move the element outside the broken element.
range.insertNode( this.remove() );

// Re-insert the extracted piece after the element.
docFrag.insertAfterNode( this );
// In case of Internet Explorer, we must check if there is no background-color
// added to the element. In such case, we have to overwrite it to prevent "switching it off"
// by a browser (#14667).
if ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) {
tmpElement = new CKEDITOR.dom.element( 'div' );

while ( current = docFrag.getFirst() ) {
if ( current.$.style.backgroundColor ) {
// This is a necessary hack to make sure that IE will track backgroundColor CSS property, see
// http://dev.ckeditor.com/ticket/14667#comment:8 for more details.
current.$.style.backgroundColor = current.$.style.backgroundColor;
}

tmpElement.append( current );
}

// Re-insert the extracted piece after the element.
tmpElement.insertAfter( this );
tmpElement.remove( true );
} else {
// Re-insert the extracted piece after the element.
docFrag.insertAfterNode( this );
}
},

/**
@@ -513,6 +513,30 @@
assert.areSame( 'abc def ghi', getInnerHtml( playground ) );
},

// #14667
'test removing background color in IE': function() {
if ( !CKEDITOR.env.ie || CKEDITOR.env.edge ) {
assert.ignore();
}

var ct = playground,
style = new CKEDITOR.style( {
element: 'span',
styles: {
'background-color': '#ff0'
},
type: CKEDITOR.STYLE_INLINE
} ),
range;

range = bender.tools.setHtmlWithRange( ct, '<p><span style="background-color: rgb(255, 255, 0);">Text [with] background</span></p>' )[ 0 ];
style.removeFromRange( range );

// Internet Explorer 8 return color without the spaces.
assert.areSame( fixHtml( '<p><span style="background-color: rgb(255, 255, 0);">Text </span>with<span style="background-color: rgb(255, 255, 0);"> background</span></p>' ),
fixHtml( getInnerHtml( ct ).replace( /rgb\(255,255,0\)/g, 'rgb(255, 255, 0)' ) ) );
},

'test filler is preserved when applying block style': function() {
if ( !CKEDITOR.env.needsBrFiller )
assert.ignore();
@@ -1001,4 +1025,4 @@

bender.test( tcs );

} )();
} )();
@@ -0,0 +1,10 @@
<div id="editor1">
<p><span style="background-color: rgb(255,255,0);">Text with background</span></p>
</div>

<script>
if ( !CKEDITOR.env.ie || CKEDITOR.env.edge ) {
bender.ignore();
}
CKEDITOR.replace( 'editor1', {} );</script>
@@ -0,0 +1,18 @@
@bender-tags: style, tc, 4.5.10, 14667
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, removeformat, toolbar, colorbutton

**Only in IE9+**

**Procedure:**

1. Select "with".
1. Click "Remove Format" button in the toolbar.

**Expected:**

Background is removed from the selected word.

**Unexpected:**

Background is removed from the entire paragraph or from the selected word to the end of the paragraph.

0 comments on commit b997321

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