Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #295 from ckeditor/t/ckeditor5/383
Browse files Browse the repository at this point in the history
Other: Removed the CKEditor 5 logger and its usage. Part of ckeditor/ckeditor5#383.

BREAKING CHANGE: Removed the CKEditor 5 logger utility.
  • Loading branch information
Piotr Jasiun authored Jul 19, 2019
2 parents cf06347 + 38198d0 commit 584ef1d
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 257 deletions.
31 changes: 10 additions & 21 deletions src/dom/rect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import isRange from './isrange';
import isWindow from './iswindow';
import getBorderWidths from './getborderwidths';
import log from '../log';
import isText from './istext';
import { isElement } from 'lodash-es';

Expand Down Expand Up @@ -67,26 +66,16 @@ export default class Rect {
} );

if ( isElement( source ) || isSourceRange ) {
const sourceNode = isSourceRange ? source.startContainer : source;

if ( !sourceNode.ownerDocument || !sourceNode.ownerDocument.body.contains( sourceNode ) ) {
/**
* The `Rect` class depends on `getBoundingClientRect` and `getClientRects` DOM methods.
* If the {@link #constructor source} of a rect in an HTML element or a DOM range but it does
* not belong to any rendered DOM tree, these methods will fail to obtain the geometry and
* the rect instance makes little sense to the features using it.
*
* To get rid of this warning make sure the source passed to the constructor
* is a descendant of `window.document.body`.
*
* @error rect-source-not-in-dom
* @param {String} source The source of the Rect instance.
*/
log.warn(
'rect-source-not-in-dom: The source of this rect does not belong to any rendered DOM tree.',
{ source }
);
}
// The `Rect` class depends on `getBoundingClientRect` and `getClientRects` DOM methods. If the source
// of a rect in an HTML element or a DOM range but it does not belong to any rendered DOM tree, these methods
// will fail to obtain the geometry and the rect instance makes little sense to the features using it.
// To get rid of this warning make sure the source passed to the constructor is a descendant of `window.document.body`.
// @if CK_DEBUG // const sourceNode = isSourceRange ? source.startContainer : source;
// @if CK_DEBUG // if ( !sourceNode.ownerDocument || !sourceNode.ownerDocument.body.contains( sourceNode ) ) {
// @if CK_DEBUG // console.warn(
// @if CK_DEBUG // 'rect-source-not-in-dom: The source of this rect does not belong to any rendered DOM tree.',
// @if CK_DEBUG // { source } );
// @if CK_DEBUG // }

if ( isSourceRange ) {
copyRectProperties( this, Rect.getDomRangeRects( source )[ 0 ] );
Expand Down
76 changes: 0 additions & 76 deletions src/log.js

This file was deleted.

7 changes: 5 additions & 2 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

/* globals window, global */

import log from './log';
import { version } from 'ckeditor5/package.json';
import CKEditorError from './ckeditorerror';

const windowOrGlobal = typeof window === 'object' ? window : global;

Expand Down Expand Up @@ -138,7 +138,10 @@ if ( windowOrGlobal.CKEDITOR_VERSION ) {
*
* @error ckeditor-duplicated-modules
*/
log.error( 'ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.' );
throw new CKEditorError(
'ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.',
null
);
} else {
windowOrGlobal.CKEDITOR_VERSION = version;
}
2 changes: 1 addition & 1 deletion tests/_utils-tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe( 'utils - testUtils', () => {
} );

it( 'should create an observer', () => {
function Emitter() { }
function Emitter() {}
Emitter.prototype = EmitterMixin;

expect( observer ).to.be.instanceof( Emitter );
Expand Down
8 changes: 4 additions & 4 deletions tests/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.deep.equal( [ 'foo' ], 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand All @@ -538,7 +538,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.equal( needl, 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand All @@ -555,7 +555,7 @@ describe( 'Collection', () => {
sinon.assert.calledWithExactly( spy, callback, ctx );
expect( ret ).to.deep.equal( [ needl ], 'ret value was forwarded' );

function callback() { }
function callback() {}
} );
} );

Expand Down Expand Up @@ -700,7 +700,7 @@ describe( 'Collection', () => {
} );

it( 'does not chain', () => {
const returned = collection.bindTo( new Collection() ).using( () => { } );
const returned = collection.bindTo( new Collection() ).using( () => {} );

expect( returned ).to.be.undefined;
} );
Expand Down
Loading

0 comments on commit 584ef1d

Please sign in to comment.