-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
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
[major] BEM-XJST: modifier templates should apply before def() #490
base: master
Are you sure you want to change the base?
Conversation
Looks like it’s patch… but I still have doubt about it. |
docs/en/5-templates-syntax.md
Outdated
@@ -350,7 +350,7 @@ def()(value) | |||
|
|||
The `def` mode (short for "default") has a special status. It is responsible for generating the result as a whole. This mode defines the list of other modes and the order to go through them, as well as the build procedure for getting the final representation of the HTML element or BEMJSON from the parts generated in the other modes. | |||
|
|||
This is a special mode that shouldn’t be used unless truly necessary. A user-defined template that redefines `def` disables calls of the other modes by default. | |||
This is a special mode that shouldn’t be used unless truly necessary. A user-defined template that redefines `def` disables calls of the other modes by default, exept `mods`, `elemMods`, `addMods` and `addElemMods`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zxqfox thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
020fa6a
to
fad15d2
Compare
Turbo? ;) |
8664edb
to
12575ca
Compare
12575ca
to
0892028
Compare
364a5e8
to
e542cd7
Compare
@zxqfox it’s a major changes. Integration tests are red. https://nda.ya.ru/3TwoUQ Template from turbo: block('list')(
def()((node, ctx) => applyNext({ items: [].concat(ctx.content || []) })),
addMods()((node, ctx) => {
const mods = { [ctx.ordered ? 'ordered' : 'unordered']: true };
ctx.ordered && node.items.length > 10 && (mods['wide-numbers'] = true);
// у ВинФонов в шрифтах нет некоторых символов, используемых для маркеров
if ((node.data.reqdata.device_detect.OSFamily || '').toLowerCase() === 'windowsphone') {
mods['alt-markers'] = true;
}
return mods;
}),
… |
Okay, let's consider this as breaking, but it's a bad code on their side, they can't guarantee they have 😢 but true. |
PR is locked and waiting next major release. |
Fixes #482