#37 cannot change attribute values

open
None
7
2010-08-11
2010-08-10
No

Possibly related to 3039052.

In dataisland branch r445, setvalue (and as a result for controls) cannot set attribute values.

Discussion

  • example shows elements work but attrs fail

     
    Attachments
    • priority: 5 --> 7
     
  • It seems that XFModel.prototype.addChange is only handling changes to elements.

    Here's a workaround built with little understanding of why this was the case:

    XFModel.prototype.addChange = function(node) {
    var list = xforms.building? this.newNodesChanged : this.nodesChanged;

    if \(\!inArray\(node, list\)\) \{
        xforms.addChange\(this\);
    \}
    while \(\(\(node.nodeType == NodeType.ELEMENT\) || \(node.nodeType == NodeType.ATTRIBUTE\)\) && \!inArray\(node, list\)\) \{
        list.push\(node\);
    

    if (node.nodeType == NodeType.ATTRIBUTE)
    node = node.ownerElement;
    node = node.parentNode;
    }
    };

     
  • It seems that XFModel.prototype.addChange only records changes to Elements.

    Here's a workaround, written without understanding of why addChange was behaving that way in the first place:

    XFModel.prototype.addChange = function(node) {
    var list = xforms.building? this.newNodesChanged : this.nodesChanged;

    if \(\!inArray\(node, list\)\) \{
        xforms.addChange\(this\);
    \}
    while \(\(\(node.nodeType == NodeType.ELEMENT\) || \(node.nodeType == NodeType.ATTRIBUTE\)\) && \!inArray\(node, list\)\) \{
        list.push\(node\);
    

    if (node.nodeType == NodeType.ATTRIBUTE)
    node = node.ownerElement;
    node = node.parentNode;
    }
    };

     
  • diff showing proposed workaround described in notes

     
    Attachments
  • Please review.

     
    • assigned_to: nobody --> alain-couthures