소스 검색

Moved the definition of Collection.length from the constructor to the prototype.

fredck 10 년 전
부모
커밋
91f0f06728
1개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 11 11
      packages/ckeditor5-ui/src/mvc/collection.js

+ 11 - 11
packages/ckeditor5-ui/src/mvc/collection.js

@@ -22,17 +22,6 @@ CKEDITOR.define( [ 'emitter', 'utils' ], function( EmitterMixin, utils ) {
 		Object.defineProperty( this, '_models', {
 			value: []
 		} );
-
-		/**
-		 * The number of items available in the collection.
-		 *
-		 * @property length
-		 */
-		Object.defineProperty( this, 'length', {
-			get: function() {
-				return this._models.length;
-			}
-		} );
 	}
 
 	/**
@@ -40,6 +29,17 @@ CKEDITOR.define( [ 'emitter', 'utils' ], function( EmitterMixin, utils ) {
 	 */
 	Collection.extend = utils.extendMixin;
 
+	/**
+	 * The number of items available in the collection.
+	 *
+	 * @property length
+	 */
+	Object.defineProperty( Collection.prototype, 'length', {
+		get: function() {
+			return this._models.length;
+		}
+	} );
+
 	utils.extend( Collection.prototype, EmitterMixin, {
 		/**
 		 * Adds an item into the collection.