Преглед изворни кода

Apply suggestions from code review

Co-Authored-By: Piotrek Koszuliński <pkoszulinski@gmail.com>
Mateusz Samsel пре 6 година
родитељ
комит
0814336175

+ 2 - 1
packages/ckeditor5-engine/src/model/element.js

@@ -113,7 +113,8 @@ export default class Element extends Node {
 	 * @returns {Boolean}
 	 */
 	is( type, name = null ) {
-		const cutType = type.replace( 'model:', '' );
+		const cutType = type.replace( /^model:/, '' );
+
 		if ( !name ) {
 			return cutType == 'element' || cutType == this.name || super.is( type );
 		} else {

+ 2 - 1
packages/ckeditor5-engine/src/view/attributeelement.js

@@ -128,7 +128,8 @@ export default class AttributeElement extends Element {
 	 * @inheritDoc
 	 */
 	is( type, name = null ) {
-		const cutType = type && type.replace( 'view:', '' );
+		const cutType = type && type.replace( /^view:/, '' );
+
 		if ( !name ) {
 			return cutType == 'attributeElement' || super.is( type );
 		} else {