i-bem__dom: internal refactoring

cc @veged @narqo