-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
isDomNode() is confusing #4985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/Users/oleq/CK/5/ckeditor5/packages/ckeditor5-ui/src/template.js:
17 import cloneDeepWith from '@ckeditor/ckeditor5-utils/src/lib/lodash/cloneDeepWith';
18 import isObject from '@ckeditor/ckeditor5-utils/src/lib/lodash/isObject';
19: import isDomNode from '@ckeditor/ckeditor5-utils/src/dom/isdomnode';
20 import log from '@ckeditor/ckeditor5-utils/src/log';
21
..
704 container.appendChild( child.element );
705 }
706: } else if ( isDomNode( child ) ) {
707 container.appendChild( child );
708 } else {
...
1178 } else {
1179 for ( const child of def.children ) {
1180: if ( isTemplate( child ) || isView( child ) || isDomNode( child ) ) {
1181 children.push( child );
1182 } else {
/Users/oleq/CK/5/ckeditor5/packages/ckeditor5-utils/src/dom/emittermixin.js:
11 import uid from '../uid';
12 import extend from '../lib/lodash/extend';
13: import isDomNode from './isdomnode';
14
15 /**
..
57 // Check if emitter is an instance of DOM Node. If so, replace the argument with
58 // corresponding ProxyEmitter (or create one if not existing).
59: if ( isDomNode( emitter ) ) {
60 args[ 0 ] = this._getProxyEmitter( emitter ) || new ProxyEmitter( emitter );
61 }
..
86
87 // Check if emitter is an instance of DOM Node. If so, replace the argument with corresponding ProxyEmitter.
88: if ( isDomNode( emitter ) ) {
89 const proxy = this._getProxyEmitter( emitter );
90
window instanceof Node; // -> false And I think the only thing confusing here is the name of the method. It does suggest a comparison against |
I agree that it's very strange that method called |
Maybe we should simply
|
|
Then let's use something smarter but separate the util from |
Fix: Bulletproofed `isDomNode()` helper when used in iframes. Removed `isWindow()` logic from the helper. Closes #201.
Introduced in (without a ticket or at least a commit message): ckeditor/ckeditor5-utils@fafd3d3.
It doesn't check if something is a node. It doesn't do much more than lodash's
isNative()
so I'd like to know why it was needed.The text was updated successfully, but these errors were encountered: