sidewinderlabs/backplanejs — Issue #98: insert does not evaluate @at="last()" correctly
Author: backplane-import
Created: 2011-10-16 04:25:49+00:00
State: open

### Imported from backplanejs Google Code [issue 98](http://code.google.com/p/backplanejs/issues/detail?id=98).

Reporter
fdintino

Date
16 Aug 2010 12:17:00 AM UTC

See XForms 1.1 spec 10.3.4 at http://www.w3.org/TR/xforms11/#action-insert :

...
[I]f the at attribute is not given, then the insert location node is the last node of the Node Set Binding node-set. Otherwise, an insert location node is determined from the at attribute as follows:

The evaluation context node is the first node in document order from the Node Set Binding node-set, the context size is the size of the Node Set Binding node-set, and the context position is 1.
...

Consider the following model:

1
2
4

3

Expected output:

There should be four nodes under /data/list, with values 1, 2, 3, 4 (in that order)

Current output:

Four nodes under /data/list with values 3, 1, 2, 4 (in that order)

This is because the context is not having the size and position set, so last() is not evaluating correctly.