Skip to content
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

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

Open
berridgeab opened this issue Jul 8, 2015 · 0 comments
Open

Comments

@berridgeab
Copy link

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;
            }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant