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

Inputs should not mutate value on type conversion (when they stringify to the same thing) #9806

Merged
merged 1 commit into from May 30, 2017

Commits on May 29, 2017

  1. Inputs should not mutate value on type conversion

    This is a follow-up on
    facebook#9584 (comment). There
    is no need to assign the value property of an input if the value
    property of the React component changes types, but stringifies to the
    same value. For example:
    
    ```javascript
    DOM.render(<input value="true" />, el)
    DOM.render(<input value={true} />, el)
    ```
    
    In this case, the assignment to `input.value` will always be
    cast to the string "true". There is no need to perform this
    assignment. Particularly when we already cast the value to a string
    later:
    
    ```javascript
    // Cast `value` to a string to ensure the value is set correctly. While
    // browsers typically do this as necessary, jsdom doesn't.
    node.value = '' + value;
    ```
    nhunzaker committed May 29, 2017
    Copy the full SHA
    896e94d View commit details
    Browse the repository at this point in the history