Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
Knockout 3.5.0 beta release notes
Full list of issues: https://github.com/knockout/knockout/milestone/9?closed=1
Important: This release includes some minor breaking changes to the
foreach binding to improve performance and clarify features. These changes can be turned off using global options.
When using the
asoption with the
foreachbinding, Knockout will set the named value for each item in the array but won't create a child context. In other words, when using
as, you will have to use the named value in bindings:
text: item.propertyrather than
text: property. This can be controlled by setting
ko.options.createChildContextWithAs = true. (See #907)
To improve performance when array changes are from a known, single operation, such as
foreachbinding no longer filters out destroyed items by default. To turn this off and filter out destroyed items, you can set
includeDestroyed: falsein the
foreachbinding or set
ko.options.foreachHidesDestroyed = trueto use the previous behavior by default. (See #2324)
- You can react to the completion of bindings such as
withusing the new
childrenCompletebinding or subscribing to the
- You can react to the completion of components, including nested components, by including a
koDescendantsCompletemethod in the component viewmodel or subscribing to the
descendantsCompletebinding event. (See #2319)
- Binding strings can include template literals (backticks) and C++ and C-style comments.
- Observable arrays include
reversedmethods that return a modified copy of the array. This is in contrast to
reversethat modify the array itself.
- The new
classbinding supports dynamic class strings. This allows you to use the
classbindings together to support both methods of setting CSS classes.
- The new
usingbinding, similarly to
with, binds its descendant elements in the context of the child viewmodel. Unlike
with, which re-renders its contents when the viewmodel changes,
usingwill just trigger each descendant binding to update.
- The new
hiddenbinding works oppositely to
- The new
letbinding allows you to set values that can be used in all descendant element bindings, regardless of context.
- Similarly to
let, you can set such values at the root context by providing a function as the third parameter to
ko.applyBindings. (See #2024)
- Performance improvement: String templates are no longer parsed each time they are referenced. Instead the parsed nodes are cached and cloned.
- Observables notify a new
spectateevent whenever their value changes. Unlike the standard
changeevent, this new event isn't necessarily delayed by rate-limiting or deferred updates. You can subscribe to the event without waking a sleeping pure computed; the computed will notify the event if it is accessed with a new value.
- Computed observables include a
getDependenciesmethod that returns an array of the observables that the computed is currently watching.
attrbinding supports namespaced attributes such as
ko.whenfunction allows you to run code once when an observable or condition becomes true.
ko.isObservableArrayfunction can be used to check if something is a
stylebinding will use
jQueryif present. Even without jQuery, the binding now supports standard style names, such as
background-color, and automatically appends
pxif needed to styles that expect it.
- Knockout will throw an error if it finds an unmatched closing virtual element (
30 or so separate fixes are included in this release,