Skip to content

Releases: knockout/knockout

v3.3.0-alpha

13 Nov 10:41
Compare
Choose a tag to compare
v3.3.0-alpha Pre-release
Pre-release
Add tag v3.3.0-alpha

Version 3.2.0

12 Aug 11:28
Compare
Choose a tag to compare

Knockout 3.2.0 release notes

Enhancements

  • 1290 - Components infrastructure and binding. Reusable, extensible components that can dynamically combine a view model and template. Component documentation
  • 1385 - Custom elements as a way to consume components (example: <my-component params="value: price, format: priceFormat"></my-component>). Custom element documentation
  • 1359 - ko.pureComputed - a computed that sleeps when it has no dependencies. Pure computed documentation
  • 1160 - Added textInput binding for robust handling of real-time updates (key presses, pasting, drag-and-drop, etc.) to a field as an alternative to value binding with valueUpdate options. textInput documentation
  • 1146 - Make the value binding act like checkedValue when used on same element as checked binding.
  • 1039 - Bower support now includes distributable (built) files (3.1.0 release was also updated to include these files).

Fixes

  • 1334 - Fixed an issue with the value binding when used with afterkeydown and rateLimit.
  • 972 - Fixed handling of 0 in style binding.
  • 1252 - Fixed ko.utils.postJson truncation issue.
  • 1433 - Make template/foreach work with an observable name option.

Version 3.2.0 Beta

19 Jun 10:19
Compare
Choose a tag to compare
Version 3.2.0 Beta Pre-release
Pre-release
v3.2.0-beta

Add tag v3.2.0-beta

Version 3.2.0 Alpha

19 Jun 10:19
Compare
Choose a tag to compare
Version 3.2.0 Alpha Pre-release
Pre-release
v3.2.0-alpha

Add tag v3.2.0-alpha

Version 3.1.0

04 Mar 21:01
Compare
Choose a tag to compare

This release focuses mainly on performance and stability/compatibility improvements, plus small enhancements to existing functionality (yes, we're saving the big new features for v3.2). So, in 3.1:

New features

  • #1190 - new rate limiting functionality to have better control and flexibility over throttle/debounce scenarios
  • #1003 - renderTemplate now supports the name argument being observable.
  • #647 - add valueAllowUnset option that allows the value binding to accept a selected value that is not currently in the list of options
  • #627 - provide access to dependency count and whether it is the first evaluation within a computed
  • #1151 - provide item index to array util method callbacks
  • #1272 - deferred computeds will now be evaluated on a manual subscription, if not previously evaluated
  • #865 - ko.utils.domNodeDisposal.cleanExternalData extensibility point can be overriden (perhaps to prevent jQuery.cleanData from being called in some scenarios)

Perf improvements

  • #775 - in browsers that support setting proto, set subscribable/observable/computed/observableArray prototype rather than copy methods from "fn" objects.
  • #1221 - use objects instead of arrays to track computed dependencies (can be major perf boost in older IE when there are lots of dependencies on a single computed/observable).
  • #1199 - various performance optimizations related to array operations

Bugs fixed

  • #844 - prevent older IE errors with options binding used in separate document
  • #1081 - prevent option placeholder from being re-added in update
  • #1191 - remove jQuery workaround related to checked binding when using newer jQuery versions.
  • #1193 - look for jQuery instance in ko.applyBindings, if it was not available when KO was loaded. This helps to prevent issues with KO not taking advantage of jQuery, if it was not loaded before KO.
  • #1206 - for observable view models, $rawData should be the observable
  • #1207 - "arrayChange" tracking no longer assumes all items added are new on a splice
  • #1208 - older IE issue with options binding related to optionsCaption being removed on each update
  • #1209 - prevent a deferred computed that is disposed before evaluation from taking dependencies when evaluated
  • #1214 - prevent errors when using the value binding with jQuery templates
  • #1255 - track observables accessed in getBindingAccessors - helps backwards compatibility with custom binding providers
  • #1289 - prevent adding a disposal callback when disposeWhenNodeIsRemoved value is not a node
  • #1306 - value binding - fix issue related to autocomplete tracking always firing update in browsers that don't fire change event on autocomplete

Version 3.1.0 Beta

12 Feb 21:04
Compare
Choose a tag to compare
Version 3.1.0 Beta Pre-release
Pre-release

Update: For a description of what's in v3.1.0 beta, please see the v3.1.0 production release, since the contents are exactly the same.

Version 3.0.0

25 Oct 10:10
Compare
Choose a tag to compare

Version 3.0.0 Release Candidate

30 Sep 10:52
Compare
Choose a tag to compare
Pre-release

Changes since 3.0.0beta:

  • Addition of arrayChange event for ko.observableArray and trackArrayChanges extender for adding this functionality to any observable.
  • Support binding to detached nodes.
  • Support arrays of observables.
  • Computed observables notify only when their value changes, using the same logic as regular observables. Use the notify extender to have a computed always notify.
  • optionsCaption sets value as text instead of HTML

Version 3.0.0 beta

08 Jul 19:59
Compare
Choose a tag to compare
Version 3.0.0 beta Pre-release
Pre-release
  1. Independent bindings: When an element has more than one binding, such as visible: showPlaylist, template: 'playlistTmpl', each binding is updated in a separate computed observable, and observables accessed by one binding won't affect any others. To receive all the benefits of independent bindings, you should note the following interface changes: (The old interfaces are still supported for backwards compatibility.)

    • Within binding handlers, access sibling bindings by calling the get method of the allBindings parameter. To check for the existence of a sibling binding, use the has method. Getting the value of a sibling binding adds a dependency on any observables accessed in the binding's value expression.
    • ko.applyBindingsToNode is superseded by ko.applyBindingAccessorsToNode. The second parameter takes an object with pairs of bindings and value-accessors (functions that return the binding value). It can also take a function that returns such an object. (This interface isn't currently documented on the website.)
    • A binding provider should implement a getBindingAccessors function instead of (or in addition to) getBindings. Similarly to the above, it should return an object with bindings and value-accessors for any nodes that have bindings. (The binding provider interface also isn't documented on the website.)
  2. Ordered bindings: When an element has more than one binding, and when the order of updating those bindings is important, such as value: selectedValue, options: choices, Knockout will bind them in the right order. This is handled automatically for built-in bindings, and custom bindings can take advantage of this through a new interface. A binding handler can have an after property with an array of other bindings that it should come after. For example, the value handler has after: ['options', 'foreach'].

  3. Preprocessing bindings: Binding handlers can define a preprocess function that is called with the code of the binding value before it is evaluated. This can be used to modify the value or add extra bindings based on the value. Suppose you have a binding that expects a string, but you want to allow the user to provide an unquoted string. You could define a preprocess function that adds quotes to unquoted values:

    preprocess: function(value) {
        if (value[0] !== "'" && value[0] !== '"')
            return '"' + value + '"';
        else
            return value;
    }
    
  4. Preprocessing nodes: The binding provider can define a preprocessNode function that is called with each node in the document before it is processed for bindings. This function can modify the node or replace it with new nodes. This could be used to make syntax like Name: {{ firstName }} work by detecting {{ expr }} expressions in text nodes and inserting <!-- ko text: expr --><!-- /ko --> before binding are applied to that node.

  5. Dynamic binding handlers: Normally, binding handlers are defined before bindings are applied by adding handler objects to ko.bindingHandlers. But you can also define handlers dynamically by overriding the ko.getBindingHandler function. This function is given a binding string and returns the handler for that binding (or undefined if none exists). Here's an example that allows you use any binding starting with data- to set data attributes:

    var originalGetHandler = ko.getBindingHandler;
    ko.getBindingHandler = function(bindingKey) {
        var handler = originalGetHandler(bindingKey);
        if (!handler && bindingKey.match(/^data-/)) {
            handler = ko.bindingHandlers[bindingKey] = {
                update: function(element, valueAccessor) {
                    element.setAttribute(bindingKey, ko.unwrap(valueAccessor()));
                }
            };
        }
        return handler;
    }
    
  6. checkedValue binding: Normally, the checked binding will use the input's value property, which is limited to string values, when updating its value. But if you also provide a checkedValue binding, its value will be used instead; this provides a way to use a value of any type with the checked binding.

  7. Observable view models: This is still a bit experimental. The idea is that you can have the view model be dynamic without having to use templates and re-render the whole DOM. Instead, changing the view model will update each of the individual bindings. More detail later...

  8. options binding generates change event: When the options change, the options binding tries to maintain the list selection so that the value of the selection stays the same. But if the selection changes because the selected value was removed, the options binding will generate a change event for the element. Other bindings that listen for change events, such as value and selectedOptions, will then be updated.

Version 2.3.0

08 Jul 19:28
Compare
Choose a tag to compare

Features:

  • hasfocus renamed to hasFocus (hasfocus will still continue to work as well)
  • name parameter of template can accept an observable
  • ko.unwrap added as substitute for ko.utils.unwrapObservable
  • options binding uses same technique as foreach to avoid unnecessary re-rendering
  • optionsAfterRender callback added to allow for custom processing of the added options
  • optionsCaption will display a blank caption if the value is an empty string

Bugs fixed:

  • hasfocus: requires two Tab presses to blur (and related issues) in Chrome; throws error in IE9 on initial binding
  • Error when you try to inline knockout because of </script> string
  • If first node in string template has a binding, the bindings in the template won't get updated
  • selectedOptions doesn't update non-observable properties
  • css won't accept class names with special characters
  • Applying binding twice to the same nodes fails in strange ways (now it fails with an obvious error message)
  • Two-way bindings overwrite a read-only computed property with a plain value
  • Empty template throws an error with jQuery 1.8+
  • observableArray can be initialized with non-array values
  • Event binding init fails if Object.prototype is extended (fixed all for...in loops)
  • Calling ko.isSubscribable with null or undefined causes an error
  • Binding to null or undefined causes an error
  • Memory leak in IE 7, 8 and 9 from event handlers
  • options binding causes error in IE8+ in compatibility mode
  • value binding on select doesn't match null with caption option
  • Invalid element in string template can cause a binding error
  • Conditionally included select gets close to zero width in IE7-8
  • ko.toJS treats Number, String and Boolean instances as objects
  • value binding misses some updates (1 -> "+1")
  • Exception in ko.computed read function kills the computed
  • Error if spaces around = in data-bind attribute in string template

Maintenance:

  • Port tests to Jasmine
  • Support Node.js
  • Remove build output files and Windows build scripts
  • Build script runs tests using build output (using PhantomJS and Node.js)
  • Use faster string trim function
  • Add automated multi-browser testing using Testling-CI