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

Section template within repeated section doesn't work #2642

Closed
ebruchez opened this Issue Mar 23, 2016 · 3 comments

Comments

Projects
None yet
1 participant
@ebruchez
Collaborator

ebruchez commented Mar 23, 2016

It doesn't seem to bind to the proper node.

See also #2641.

@ebruchez ebruchez self-assigned this Mar 23, 2016

@ebruchez ebruchez added this to the 4.11 milestone Mar 23, 2016

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Mar 23, 2016

Collaborator

I think I found the cause. The xxf:binding-context() function, when within a repeat, resolves to the entire item sequence.

So say there is a repeat over two iterations:

  • The BindingContext for the first repeat iteration contains the two nodes and a position of 1.
  • The BindingContext for the second repeat iteration contains the two nodes and a position of 2.
  • But a nested XBL component without single-node binding asking for the binding context gets, in both cases, the entire item sequence, containing both nodes.
  • So both nested section templates end up binding to the same node: the first repeat iteration. This is incorrect, and the behavior even appears unpredictable.

To fix this, we need to make it so that xxf:binding-context() returns a single item, taking the position into account.

This is consistent with resolution of nested single-item binding controls, which use position to evaluate the XPath expression of the binding.

Collaborator

ebruchez commented Mar 23, 2016

I think I found the cause. The xxf:binding-context() function, when within a repeat, resolves to the entire item sequence.

So say there is a repeat over two iterations:

  • The BindingContext for the first repeat iteration contains the two nodes and a position of 1.
  • The BindingContext for the second repeat iteration contains the two nodes and a position of 2.
  • But a nested XBL component without single-node binding asking for the binding context gets, in both cases, the entire item sequence, containing both nodes.
  • So both nested section templates end up binding to the same node: the first repeat iteration. This is incorrect, and the behavior even appears unpredictable.

To fix this, we need to make it so that xxf:binding-context() returns a single item, taking the position into account.

This is consistent with resolution of nested single-item binding controls, which use position to evaluate the XPath expression of the binding.

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Mar 23, 2016

Collaborator

Note that this doesn't fix #2641.

Collaborator

ebruchez commented Mar 23, 2016

Note that this doesn't fix #2641.

@ebruchez

This comment has been minimized.

Show comment
Hide comment
@ebruchez

ebruchez Mar 23, 2016

Collaborator
  • unit test for modified function
  • document xxf:binding-context() here
Collaborator

ebruchez commented Mar 23, 2016

  • unit test for modified function
  • document xxf:binding-context() here

@ebruchez ebruchez closed this in 9623b95 Mar 23, 2016

@ebruchez ebruchez removed the Missing Tests label Mar 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment