enketo-core
enketo-core copied to clipboard
Fix: setgeopoint actions correctly identify their affected nodeset
Current behavior:
- Actions defined in the model, or in the body adjacent its input, populate the model correctly.
- Actions nested within their input, with an explicit
ref
attribute, fail to update the view. This is because there is a hidden HTML input representing the action (distinct from the input representing the model value), which the current behavior selects. - Actions nested within their input, without an explicit
ref
attribute, replace the entire descendant tree of the model with the geopoint value. The cause is identical to the explicit-ref case, but the erroneously selected input has noname
attribute. This causes the model update, inNodeset.setVal
, to evaluate against a nodeset resolving to the rootdata
node.
A couple open questions:
-
Should the third case described above ever be allowed to happen? My instinct is that we should never allow calling
setVal
on a node with children. -
How does this affect performance? It's definitely doing more work. It seems fine on my obviously small test form, but I'm not sure how much it'll impact larger or more complex forms.