Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Expose inverse block to component hook #340

Merged
merged 1 commit into from
May 11, 2015
Merged

Conversation

ef4
Copy link
Collaborator

@ef4 ef4 commented May 9, 2015

This exposes the inverse template to the component hook, and parameterized bindBlock and yield so they can optionally use other block names (which will presumably just be "inverse" for now).

@@ -909,9 +914,9 @@ export function getCellOrValue(reference) {
return reference;
}

export function component(morph, env, scope, tagName, params, attrs, template, visitor) {
export function component(morph, env, scope, tagName, params, attrs, template, inverse, visitor) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we just make this:

export function component(morph, env, scope, tagName, params, attrs, templates, visitor) { }

Where templates is an object that contains template and inverse properties? That would in theory align us for future work in Handlebars/HTMLBars for named blocks without changing the component hook signature again...

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

htmlbars is chock full of functions that accept template and inverse as separate arguments. To do this right, we would change almost all of them to pass around a templates object instead. That looks like a big refactor. I'm going to limit my change to the component hook for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That makes sense. I will make an issue to track refactoring the rest...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Created: #341

@ef4 ef4 force-pushed the yield-to-inverse branch from f483ccb to abcaea2 Compare May 9, 2015 17:35
@ef4
Copy link
Collaborator Author

ef4 commented May 9, 2015

Incorporated feedback from @wycats and @rwjblue, and ready for review.

@wycats
Copy link
Contributor

wycats commented May 9, 2015

Any chance for tests?

@ef4
Copy link
Collaborator Author

ef4 commented May 9, 2015

If there were any existing tests covering these areas, I would happily have extended them. But there are not, and I don't have sufficient context to create a meaningful test harness from scratch.

rwjblue added a commit that referenced this pull request May 11, 2015
Expose inverse block to component hook
@rwjblue rwjblue merged commit ec8c5fd into tildeio:master May 11, 2015
@rwjblue
Copy link
Collaborator

rwjblue commented May 11, 2015

Published as 0.13.17.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants