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

Register bindings on nearest parent element (or maybe not) #65

Open
m-mujica opened this issue Oct 27, 2017 · 0 comments
Open

Register bindings on nearest parent element (or maybe not) #65

m-mujica opened this issue Oct 27, 2017 · 0 comments

Comments

@m-mujica
Copy link
Contributor

For a template like:

<span>{{count}}</span>

can-view-live listens to the parent node, span (for legacy reasons, jQuery ignored textNodes) but technically the binding appears in span.firstChild.

This means, if you want to debug the template, you have to pass in the parent node, like:

debug.logWhatChangesMe(spanElement);  // current behavior, intuitive I think?

Should we make it so you have to do this instead?

debug.logWhatChangesMe(spanElement.firstChild);  // technically correct

If that's true, what happens with templates that have no parent node? E.g:

var frag = stache("{{foo}}");

Currently, can-view-live listens on the document fragment, so you'd have to do something like this to debug it:

var frag = stache("{{foo}}")

// this does not work currently, because DocumentFragment 
// does not implement the `can.getValueDependencies` symbol
debug.logWhatChangesMe(frag);

Note: it's also possible to have lists without parent node (other than the document fragment itself)

{{#if foo}} {{#each items}} {{ this }} {{/each}} {{/if}}
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

No branches or pull requests

1 participant