Skip to content

Incorrect value assigned to Input when using a numeric or empty value #20

@berridgeab

Description

@berridgeab

Hi

Affects taconite 3.65 to 3.66.

Since the introduction of 3.65 a bug has occurred. When trying to assign an empty value or a value with a leading 0, taconite will assign a different value. This bug did not occur in 3.64.

HTML to replicate bug

<input id = 'textInput' type = 'text' value = ''/>

XML to replicate bug

<taconite>
<!--Will assign '0' to the input value when the value should be empty -->
<attr select = '#textInput' name = 'value' value =''/>
<!--Will assign '12345' to the input value when the value should be '012345'-->
<attr select = '#textInput' name = 'value' value ='012345'/>
</taconite>

The Fix
Assigning the value to type primitive type Number seems to be causing the issue. I'm unsure why this is done to be honest, surely its better just to assign the value specified in the XML document.
The offending lines causing this issue is between 290 - 295.

/*Replace this */
        if (v !== null) {
            tmp = Number(v);
            if (v == tmp)
                v = tmp;
            a.push(v);
        }
/*With this*/
if (v !== null) a.push(v);

Also lines 303 - 307.

/*Comment these lines out */
           if (v.length) {
                tmp = Number(v);
                if (v == tmp)
                    v = tmp;
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions