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

anonymous templates will break in next version of knockout #199

Closed
fastfasterfastest opened this issue May 2, 2019 · 3 comments
Closed

Comments

@fastfasterfastest
Copy link

fastfasterfastest commented May 2, 2019

FYI, knockout commits knockout/knockout@0f0cb8e and knockout/knockout@a93358f which is addressing knockout/knockout#2446 breaks the knockout-sortable binding when it is used with anonymous templates and the value is an object, e.g.

<ul data-bind="sortable: { data: items }">
  <li data-bind="text: name"></li>
</ul>

The knockout-sortable binding currently passes { name: undefined, … } as the value to the template binding when it is used with anonymous templates and the value is an object, and the above mentioned commits (not yet in a public release of knockout) have changed how knockout handles a value that has a name property.

See https://jsfiddle.net/fastfasterfastest/3rekjytw/

@fastfasterfastest
Copy link
Author

In case those knockout commits appear in a future public knockout release, I believe the following change in prepareTemplateOptions will avoid this issue:
Change
result.name = options.template;
to
if (options.hasOwnProperty('template')) { result.name = options.template; }
or
if (options.template) { result.name = options.template; }

@rniemeyer
Copy link
Owner

@fastfasterfastest - thanks for the heads up

@rniemeyer
Copy link
Owner

Thanks for the heads up so long ago @fastfasterfastest. Version 1.2.0 is out with this fix.

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

2 participants