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

Fix Issue #322. block name in template includes previous text by mistake #323

Merged
merged 2 commits into from
Aug 29, 2013
Merged

Conversation

rragan
Copy link
Contributor

@rragan rragan commented Aug 11, 2013

Existing code ends up including text already in the chunk as part of the name of the block definition in a base template. Fix is to save away the existing text in the chunk, clear out the chunk data, collect the block name by calling the function and then restore whatever data was in the chunk from before.

if (typeof key === "function") {
saveData = chk.data;
chk.data = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

We are only using the chunk for it's API.

can we instead just do:
var tempChk = new Chunk();
if (typeof key==='function') {
key = key(tempChk, this).data.join('');
}

we don't need to pass in ctx since this is the context

@jimmyhchan
Copy link
Contributor

Looks good. pull when ready!

rragan added a commit that referenced this pull request Aug 29, 2013
Fix Issue #322. block name in template includes previous text by mistake
@rragan rragan merged commit e01891a into linkedin:master Aug 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants