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

Behavior changed for textarea elements with on:input:value:to #477

Open
chasenlehara opened this issue Jul 18, 2018 · 1 comment
Open

Behavior changed for textarea elements with on:input:value:to #477

chasenlehara opened this issue Jul 18, 2018 · 1 comment
Labels

Comments

@chasenlehara
Copy link
Member

In CanJS 4.2, if a textarea was bound in a component like this:

Component.extend({
  tag: "my-app",
  view: `
    <textarea on:input:value:to="prop" value:bind="prop">From view</textarea>
    <p>prop: {{prop}}</p>
  `,
  ViewModel: {
    prop: {
      default: "From VM"
    }
  }
});

…the textarea would show From VM as its value. Here’s a demo: https://jsbin.com/rotisapaxi/1/edit?html,js,output

In CanJS 4.3+, the prop gets changed to From view; demo here: https://jsbin.com/quseciqawo/1/edit?html,js,output

I haven’t had a lot of time to debug this issue, but from a quick look through the stack trace, I noticed that can-bind sets up the binding for on:input:value:to and then syncs the values; since that’s technically a one-way child-to-parent binding, it sets the parent to the child’s value. In previous versions of can-stache-bindings, I’m not sure if we skipped that initialization process, or if can-stache-bindings handled it some other way.

chasenlehara added a commit to LBH3/lbh3.org that referenced this issue Jul 18, 2018
@chasenlehara
Copy link
Member Author

@justinbmeyer I think this is a bug but I’d appreciate your confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant