Skip to content

i-bem__dom: Need a proper way to check if block was destroyed #507

@narqo

Description

@narqo

BEM.DOM.destruct() of i-bem__dom destructs found blocks in context from first to last. This could lead to some strange effects, when block that has been removed already still is trying to handle events from nested blocks that are in a destructing phase.

Live example: http://jsbin.com/nuquv/1/edit?html,js,console

Block zooo is still handling input's blur event, regardless the fact that it's instance has been destroyed already (there is no this._ppp prop in instance). At the same time, zooo is still linked to it's DOM element with this.domElem.

So there is no "official" way to handle this situation in general because we can't say is block is still a "live".

In bem-core's i-bem__dom version we could use this.hasMod('js', 'inited') for this cases. May be we could add something similar to bem-bl's one?

\cc @dfilatov

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions