There is no sense in elemMatch() since you can't test this.elem now. (More info?)
apply() behaves slightly different
Since a notable performance jump apply() can't call custom modes in other blocks.
block('b2').mode('custom')('in b2'); // won't be called
block('b1').mode('custom')('in b1'); // will be called instead
block('b1').content()(function() {
return apply('custom', { block: 'b2' });
});
Also there is no more polymorphism in apply() and you should always explicitly pass a first argument, e.g. 'default'.
applyNext() don't use guard-flags to prevent executing template in nested
Every template now applies to the each block of the same name in nested tree when called in applyNext().
Guess we should add something like this:
elemMatch()
andthis.elem
changesThere is no sense in
elemMatch()
since you can't testthis.elem
now. (More info?)apply()
behaves slightly differentSince a notable performance jump
apply()
can't call custom modes in other blocks.Also there is no more polymorphism in
apply()
and you should always explicitly pass a first argument, e.g.'default'
.applyNext()
don't use guard-flags to prevent executing template in nestedEvery template now applies to the each block of the same name in nested tree when called in
applyNext()
.E.g. for template:
And json:
Will result in:
Instead of:
Static objects shortcuts in mix, content, etc.
Because new templates were not compiled variables will share references to the same objects and that can look like a memory leak.
Just switch to function generator if you're not sure how somebody will redefine it.
For bemjson:
And templates:
You'll see unnecessary attribute
withMod
and more duplicates in mixes for each next block:once()
helper to apply template just onceLiterally, it guards template block from being applied several times.
NB: It behaves like an old
applyNext()
.Code like:
now should be rewritten to:
Or with
once()
:wrap()
helper for wrappingLiterally, it sets guard-flag into
this.ctx
, and applying context. Sugar fordef()
andapplyCtx()
.Code like:
should now be rewritten to:
Or with
wrap()
helper:replace()
helper for replacing/cc @tadatuta @veged