Skip to content

Commit

Permalink
Merge branch 't/11478b'
Browse files Browse the repository at this point in the history
  • Loading branch information
adelura committed Jun 11, 2014
2 parents 91779e8 + 734f9f1 commit c41e10c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -5,6 +5,7 @@ CKEditor 4 Changelog

Fixed Issues:

* [#11478](http://dev.ckeditor.com/ticket/11478): Fixed: Issue with passing jQuery objects to adapter configuration.
* [#10867](http://dev.ckeditor.com/ticket/10867): Fixed: Issue with setting encoded URI as image's link.
* [#10091](http://dev.ckeditor.com/ticket/10091): Blockquote should be treated like an object by the styles system. Thanks to [dan-james-deeson](https://github.com/dan-james-deeson)!
* [#11983](http://dev.ckeditor.com/ticket/11983): Fixed: Clicking a nested widget does not focus it. Additionally, performance of the [`widget.repository.getByElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-getByElement) method has been improved.
Expand Down
4 changes: 4 additions & 0 deletions core/tools.js
Expand Up @@ -109,6 +109,10 @@
if ( obj === null || ( typeof( obj ) != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) )
return obj;

// DOM objects and window.
if ( obj.nodeType || obj.window === obj )
return obj;

// Objects.
clone = new obj.constructor();

Expand Down
32 changes: 32 additions & 0 deletions tests/core/tools.js
Expand Up @@ -141,10 +141,42 @@ bender.test(
assert.areSame( 'John', obj.name );
assert.areSame( 'Paul', clone.name );

assert.areNotSame( obj.cars, clone.cars );
assert.areSame( 'red', obj.cars.Porsche.color );
assert.areSame( 'silver', clone.cars.Porsche.color );
},

test_clone_DOM: function() {
var anchor = document.createElement( 'a' );
var obj = {
anchor: anchor
};

var clone = CKEDITOR.tools.clone( obj );

assert.areSame( clone.anchor, anchor );
},

test_clone_Window: function() {
var obj = {
window: window
};

var clone = CKEDITOR.tools.clone( obj );

assert.areSame( clone.window, window );
},

test_clone_Document: function() {
var obj = {
document: document
};

var clone = CKEDITOR.tools.clone( obj );

assert.areSame( clone.document, document );
},

test_repeat: function() {
assert.areSame( '   ', CKEDITOR.tools.repeat( ' ', 3 ) );
},
Expand Down
2 changes: 2 additions & 0 deletions tests/tickets/11478/1.html
@@ -0,0 +1,2 @@
<div id="container"></div>
<textarea id="editable" cols="80" rows="10">editor1</textarea>
25 changes: 25 additions & 0 deletions tests/tickets/11478/1.js
@@ -0,0 +1,25 @@
/* bender-tags: editor,unit */
/* bender-ckeditor-adapters: jquery */
/* bender-ckeditor-plugins: wysiwygarea */

( function() {
'use strict';

bender.test( {
'test pass jQuery object into config': function() {
var configObj = {
element: $( '#container' )
};

$( '#editable' ).ckeditor( function() {
var editor = this;

resume( function() {
assert.areSame( configObj.element[ 0 ], editor.config.element[ 0 ], 'element was passed safely to editor.config' );
} );
}, configObj );

wait();
}
} );
} )();

0 comments on commit c41e10c

Please sign in to comment.