Skip to content

Commit

Permalink
Неправильный extend параметров в блоке на нескольких нодах
Browse files Browse the repository at this point in the history
  • Loading branch information
dfilatov committed Aug 2, 2012
1 parent cf6ee13 commit 51eb087
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blocks-common/i-bem/__dom/i-bem__dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function init(domElem, uniqInitId) {
if(block) {
if(block.domElem.index(domNode) < 0) {
block.domElem = block.domElem.add(domElem);
$.extend(block.params, params);
$.extend(block._params, params);
}
} else {
initBlock(blockName, domElem, params);
Expand Down
8 changes: 5 additions & 3 deletions blocks-common/i-bem/i-bem.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ this.BEM = $.inherit($.observable, /** @lends BEM.prototype */ {
* @protected
* @type Object
*/
_this._params = params; // это нужно для правильной сборки параметров у блока из нескольких нод
_this.params = null;

initImmediately !== false?
_this._init(params) :
_this._init() :
_this.afterCurrentEvent(function() {
_this._init(params);
});
Expand All @@ -135,10 +136,11 @@ this.BEM = $.inherit($.observable, /** @lends BEM.prototype */ {
* Инициализирует блок
* @private
*/
_init : function(params) {
_init : function() {

if(!this.hasMod('js', 'inited')) {
this.params = $.extend(this.getDefaultParams(), params);
this.params = $.extend(this.getDefaultParams(), this._params);
delete this._params;
this
.setMod('js', 'inited')
.trigger('init');
Expand Down

0 comments on commit 51eb087

Please sign in to comment.