Przeglądaj źródła

Add info about not calling super in is() methods.

Maciej Gołaszewski 5 lat temu
rodzic
commit
c0bc715954

+ 3 - 1
packages/ckeditor5-engine/src/model/liveposition.js

@@ -80,7 +80,9 @@ export default class LivePosition extends Position {
 	 * @returns {Boolean}
 	 */
 	is( type ) {
-		return type == 'livePosition' || type == 'model:livePosition' || type == 'position' || type == 'model:position';
+		return type == 'livePosition' || type == 'model:livePosition' ||
+			// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
+			type == 'position' || type == 'model:position';
 	}
 
 	/**

+ 3 - 1
packages/ckeditor5-engine/src/model/liverange.js

@@ -57,7 +57,9 @@ export default class LiveRange extends Range {
 	 * @returns {Boolean}
 	 */
 	is( type ) {
-		return type == 'liveRange' || type == 'model:liveRange' || type == 'range' || type == 'model:range';
+		return type == 'liveRange' || type == 'model:liveRange' ||
+			// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
+			type == 'range' || type == 'model:range';
 	}
 
 	/**

+ 1 - 0
packages/ckeditor5-engine/src/model/text.js

@@ -83,6 +83,7 @@ export default class Text extends Node {
 	 */
 	is( type ) {
 		return type === 'text' || type === 'model:text' ||
+			// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
 			type === 'node' || type === 'model:node';
 	}