We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderer.updateContent
container
outer
inner
Псевдокод:
BEM.DOM.decl('container', { render: function () { var json = { block: 'outer', js: true }; var bemjson = BEM.JSON.build(json); var html = BEMHTML.apply(bemjson); var $html = $(html); BEM.DOM.update(this, $html); } }); BEM.JSON.decl('outer', { onBlock: function (ctx) { ctx.content({ block: 'inner', js: true, mix: { block: 'outer', elem: 'inner' } }); } }); BEM.DOM.decl('outer', { onSetMod: { js: { inited: function () { BEM.DOM.destruct(this.elem('inner')); } } } }); $('<div>').addClass('container').bem('container').render();
В итоге имеем невразумительную ошибку: Cannot read property '0' of undefined.
Cannot read property '0' of undefined
Ошибки можно избежать, используя afterCurrentEvent:
afterCurrentEvent
BEM.DOM.decl('outer', { onSetMod: { js: { inited: function () { this.afterCurrentEvent(function () { BEM.DOM.destruct(this.elem('inner')); }); } } } });
Может, стоит при инициализации блока проверять, не уничтожен ли он?
The text was updated successfully, but these errors were encountered:
@dfilatov что думаешь? Стоит ли нам это делать?
Sorry, something went wrong.
Не получается воспроизвести на текущих версиях библиотек.
dfilatov
No branches or pull requests
renderer.updateContent
создаём внутри блокаcontainer
блокouter
outer
создаётся блокinner
outer
уничтожается блокinner
Псевдокод:
В итоге имеем невразумительную ошибку:
Cannot read property '0' of undefined
.Ошибки можно избежать, используя
afterCurrentEvent
:Может, стоит при инициализации блока проверять, не уничтожен ли он?
The text was updated successfully, but these errors were encountered: