From 12ad5083ed11a018dbe3134b090d1193e9929c47 Mon Sep 17 00:00:00 2001 From: dfilatov Date: Wed, 2 Jul 2014 13:50:16 +0400 Subject: [PATCH] i-bem__collection, i-bem-dom__collection: remove (close #575) --- .../_type/i-bem__collection_type_dom.deps.js | 3 - .../_type/i-bem__collection_type_dom.js | 30 -------- .../__collection/i-bem__collection.deps.js | 7 -- .../i-bem/__collection/i-bem__collection.js | 77 ------------------- .../i-bem__dom_collection_yes.deps.js | 5 -- .../_collection/i-bem__dom_collection_yes.js | 29 ------- 6 files changed, 151 deletions(-) delete mode 100644 common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.deps.js delete mode 100644 common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.js delete mode 100644 common.blocks/i-bem/__collection/i-bem__collection.deps.js delete mode 100644 common.blocks/i-bem/__collection/i-bem__collection.js delete mode 100644 common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.deps.js delete mode 100644 common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.js diff --git a/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.deps.js b/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.deps.js deleted file mode 100644 index a2046ddab..000000000 --- a/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.deps.js +++ /dev/null @@ -1,3 +0,0 @@ -({ - mustDeps : { elem : 'collection' } -}) diff --git a/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.js b/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.js deleted file mode 100644 index dd5db065f..000000000 --- a/common.blocks/i-bem/__collection/_type/i-bem__collection_type_dom.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @module i-bem__collection_type_dom - */ - -modules.define( - 'i-bem__collection_type_dom', - ['inherit', 'i-bem__collection'], - function(provide, inherit, Collection) { - -/** - * @class BEMDOMCollection - * @description Collection of BEM.DOM blocks. Implementation of BEM.DOM methods for array of blocks. - * @augments i-bem__collection - * @exports - */ - -provide(inherit(Collection, null, /** @lends BEMDOMCollection */{ - /** - * Get methods that will be implemented in BEMDOMCollection - * @override - * @returns {Array} - */ - getMethods : function() { - return this.__base().concat(['bindTo', 'bindToDoc', 'bindToDomElem', 'bindToWin', - 'unbindFrom', 'unbindFromDoc', 'unbindFromDomElem', 'unbindFromWin', - 'dropElemCache']); - } -})); - -}); diff --git a/common.blocks/i-bem/__collection/i-bem__collection.deps.js b/common.blocks/i-bem/__collection/i-bem__collection.deps.js deleted file mode 100644 index 1e615ecdf..000000000 --- a/common.blocks/i-bem/__collection/i-bem__collection.deps.js +++ /dev/null @@ -1,7 +0,0 @@ -({ - mustDeps : [ - { elem : 'dom' }, - 'inherit', - 'objects' - ] -}) diff --git a/common.blocks/i-bem/__collection/i-bem__collection.js b/common.blocks/i-bem/__collection/i-bem__collection.js deleted file mode 100644 index c7350976b..000000000 --- a/common.blocks/i-bem/__collection/i-bem__collection.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @module i-bem__collection - */ - -modules.define('i-bem__collection', ['inherit', 'objects'], function(provide, inherit, objects) { - -/** - * @class BEMCollection - * @description Base class for collections. Create collection of similar objects. - * @abstract - * @augments Array - * @exports - */ - -provide(inherit(null, /** @lends BEMCollection */{ - /** - * Get method names that will be implemented in collection - * @returns {Array} - */ - getMethods : function() { - return ['on', 'onFirst', 'un', 'trigger', - 'setMod', 'toggleMod', 'delMod', - 'afterCurrentEvent', 'destruct']; - }, - - /** - * Get base prototype for collection - * @returns {Object} - */ - getBase : function() { - return { - applyMethod : function(method, args) { - this.forEach(function(context) { - context[method] && context[method].apply(context, args); - }); - return this; - }, - - callMethod : function() { - var args = this.slice.call(arguments); - return this.applyMethod(args.shift(), args); - } - }; - }, - - /** - * Create collection instance - * @param {Array} a list of similar objects - * @returns {Object} - */ - create : function(a) { - var decl = this.getBase(); - - this.getMethods() - .forEach(function(method) { - if(!decl[method]) { - decl[method] = function() { - return this.applyMethod(method, arguments); - }; - } - }); - - /** - * "Inherit" Array using direct extend. - * See http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/. - */ - this.create = function(arr) { - arr || (arr = []); - arr.__self = this; - return objects.extend(arr, decl); - }; - - return this.create(a); - } -})); - -}); diff --git a/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.deps.js b/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.deps.js deleted file mode 100644 index be950d88b..000000000 --- a/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.deps.js +++ /dev/null @@ -1,5 +0,0 @@ -({ - shouldDeps : [ - { elem : 'collection', mod : 'type', val : 'dom' } - ] -}) diff --git a/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.js b/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.js deleted file mode 100644 index ffea3c5c2..000000000 --- a/common.blocks/i-bem/__dom/_collection/i-bem__dom_collection_yes.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @module i-bem__dom - * @description Overrides BEM.DOM.findBlocks* methods that they return i-bem__collection_type_dom - */ - -modules.define('i-bem__dom', ['i-bem__collection_type_dom'], function(provide, Collection, BEMDOM) { - -provide( - /** - * @class BEMDOM - * @augments BEMDOM - * @exports - */ - BEMDOM.decl('i-bem__dom', (function() { - var decl = {}, - wrapMethod = function() { - return Collection.create(this.__base.apply(this, arguments)); - }; - - ['findBlocksInside', 'findBlocksOutside', 'findBlocksOn'] - .forEach(function(method) { - decl[method] = wrapMethod; - }); - - return decl; - }())) -); - -});