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

Extending child contexts with container element #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cervengoc
Copy link
Collaborator

@cervengoc cervengoc commented Aug 9, 2016

This change addresses #39 by extending the child binding context with a $parentNode property. The $parentNode property refers to the - not virtual - container node, which will become the parent node of each item.

General usage recommendation for custom bindings which need to access the parent element can be like this.

var parentNode = context.$parentNode || element.parentNode;

This technique could be kind of a default workaround for any binding which control child bindings and have such a complex logic that the child nodes are not attached to the DOM yet at binding time.

As far as FastForEach goes, it would have been very difficoult to implement a logic to insert the child nodes first, and then bind them.

I'm open to any other idea.

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.

1 participant