|
|
@@ -7,14 +7,11 @@
|
|
|
* @module utils/dom/rect
|
|
|
*/
|
|
|
|
|
|
-/* globals console */
|
|
|
-
|
|
|
import isRange from './isrange';
|
|
|
import isWindow from './iswindow';
|
|
|
import getBorderWidths from './getborderwidths';
|
|
|
import isText from './istext';
|
|
|
import { isElement } from 'lodash-es';
|
|
|
-import { attachLinkToDocumentation } from '../ckeditorerror';
|
|
|
|
|
|
const rectProperties = [ 'top', 'right', 'bottom', 'left', 'width', 'height' ];
|
|
|
|
|
|
@@ -69,25 +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.
|
|
|
- */
|
|
|
- console.warn( attachLinkToDocumentation(
|
|
|
- '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 ] );
|