Skip to content
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

BEMHTML: fix position with replace() #395

Merged
merged 2 commits into from
Dec 12, 2016
Merged

Conversation

miripiruni
Copy link
Contributor

Fixes #394

@@ -80,12 +80,13 @@ ReplaceMatch.prototype.wrapBody = function wrapBody(body) {

if (typeof body !== 'function') {
return function inlineAdaptor() {
return applyCtx(body);
return applyCtx(body, { position: this.position - 1 });
Copy link
Contributor Author

@miripiruni miripiruni Dec 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFIY: applyCtx() запускает новую волну _run(). Но в BEMContext-е остаётся position, который уже был инкрементирован. Соотстветственно _run() инкрементирует position еще раз, чего не нужно делать.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавь этот комментарий прямо в код ;-)

@coveralls
Copy link

coveralls commented Dec 10, 2016

Coverage Status

Coverage remained the same at 97.041% when pulling b32094e on replace-position__issue-394 into e3221e9 on master.

@veged
Copy link
Member

veged commented Dec 12, 2016

LGTM

@miripiruni miripiruni added this to the 8.5.1. milestone Dec 12, 2016
@miripiruni miripiruni merged commit 71cca07 into master Dec 12, 2016
@miripiruni miripiruni deleted the replace-position__issue-394 branch December 12, 2016 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants