For TODO between alpha and release, see knockout#1
- (observable) When supported,
observable.length
will now be undefined (was0
before), andobservableArray.length
will now be the length of the wrapped array - (observableArraty)
observableArray
is now iterable (has aSymbol.iterator
property) - (utils) Several array utilities use native functions now (
arrayPushAll
,arrayFilter
,arrayGetDistinctValues
,arrayFirst
,arrayIndexOf
) - (various) forward-ports per #5
- (components) Warn with custom-element names that cannot be used with custom elements re. #43 & knockout/knockout#1603
- (
event
binding) Add object-based event handler e.g.event.click: { handler: fn, once: true, capture: true, bubble: false, passive: false}
. Also, bubbling can be prevented withevent.click: {bubble: false }
re #32 - (
event
binding) Addthrottle
anddebounce
parameters - The
throttle
anddebounce
utilities now pass arguments to the target functions - (components) Allow Component-specific binding handlers from
component.prototype.getBindingHandler
- (components) Issue a warning if
ignoreCustomElementWarning
is not passed to a component registration and the component name is not usable for custom elements. - (observable) Removed
then
fromobservable.fn
because it'll likely cause a lot of confusing issues with implicit unwrapping fromasync
functions. - (observable) Add
ko.proxy
and related functionsko.proxy.peek(obj, prop)
,ko.proxy.isProxied(obj)
,ko.proxy.getObservable(obj, prop)
.
- (build) Change the
tko
export toglobal.ko
for backwards compatibility (instead of global.tko).
- (components) Add
ko.Component
, an abstract base class that simplifies the Component creation and registration API (seetko.utils.component/src/ComponentABC.js
) - (with binding) Fix dependency count for function-arguments [knockout/knockout#2285]
- (options) Allow importing
ko
in node - (components) Add
getBindingHandler(key)
to use binding handlers local to a component - (docs) Add
/tko.io
with structure for building and deploying documentation website - (npm) Publishing all packages as 4.0.0-alpha4
- (build) Compiles to
dist/ko.js
(via Babel) - (build) The
dist/tko.js
(that exportedtko
) has been deprecated/removed - (internal) Add the ES6 LifeCycle class (see tko.lifecycle)
- (binding handlers) Add new-style ES6 Binding Handler class (see custom-bindings documentation and tko.bind/src/BindingHandler.js), descended from the LifeCycle class
- (lifecycle) Fix error with event handler type
- (provider) Add & document the Provider base class
- (subscribable) Add the
once
,then
,when
,yet
, andnext
functions - (parser) Fix early-out for logical (&& / ||) operators
- (binding)
ko.applyBindings
now returns a Promise that resolves when bindings are completed - (attr) Support namespaced attributes with
attr
binding #27 - (options) Add the
options.Promise
, so users can use a their own or a safe Promise variant of A+/Promises (defaults towindow.Promise
) - (attribute-interpolation) Fix interpolation of
styles
attribute (e.g.style="color: {{color}}"
) in theAttributeMustacheProvider
, by addingattributesBindingMap
parameter.
- (API) Expose
dependencyDetection.ignore
asignoreDependencies
- (foreach binding) When using the
as
parameter, the$data
remains unchanged (i.e. the context inside aforeach
is no longer a "child" context, but an extension of the current context); this deprecates thenoContext
parameter - (foreach binding) Expose the
conditional
on thedomData
for use by theelse
binding (when the array is empty, theelse
binding will be rendered) - (foreach binding) Expose
$list
inside the foreach - (foreach binding) Allow
noIndex
as a peer binding parameter (e.g.foreach: items, noIndex: true
) - (bind) String errors on binding are now propagated
- (provider) Fix dereferencing of namespaced items e.g. attr.title:
${v}
- (parser) Fix unary negation
- (foreach) Preserve focus when items are deleted and re-added (i.e. moved) in the same animation frame.
- (observable array) Incorporate 3.4 fix for memory leak
- (parser) Fix array values not being unwrapped/called e.g.
data-bind="x: [f(), observable, 1 + 6,
a ${x} c]"
- (parser) Fix interpretation of unicode characters as identifiers / variables
-
Fix negation operator (-) application - integers/floats e.g.
-1
work, as well as variables-x
and expressions-(x + y)
-
Use tko.binding.foreach for the
foreach
binding (based on brianmhunt/knockout-fast-foreach) -
Add
each
as an alias offoreach
-
Parser
- Correct behaviour with dereferencing members of expressions (e.g.
(x || y).z
or(abc || {x: null})['x']
) - Fix canonical (
() => ...
) lambdas - Support C & C++ style comments (knockout/knockout#1524)
- Fix filter/or ambiguity on pipe
|
- Raise an error with anonymous functions
- Fix && and || operator precedence
- Correct behaviour with dereferencing members of expressions (e.g.
-
Updated Rollup - changes order of compilation, smaller output
-
Fix issue with first rendering of an elseif binding
-
Make the
template
binding expose a conditional for else-binding -
Expose ko.dependencyDetection
-
Make sure
obj.x
usesthis
ofobj
wherex
is a function (e.g.click: model.onClick
hasthis
ofmodel
) -
Ensure
obj.x
only usesobj
asthis
whenx
is a prototypal method (and not just a value) -
Honour explicit references to
this
(as$data
) -
Ensure bindings with multiple filters work as expected
-
If available, use a WeakMap for DOM node data (resolves knockout/knockout#2141)
-
Fix filters not separated by whitespace (e.g.
value|filter1|filter2
)
The following are short-hands for the changes from Knockout 3.4(.1).
-
various new
options
-
rewritten as ES6 in multiple packages, so it can be mixed/matched
- e.g. observables are usable independently from knockout/tko.observable
-
rewritten data-bind parser
- add "naked"
=>
lambdas (even in legacy browsers e.g.data-bind='click: => was_clicked(true)'
- inline functions are no longer supported (e.g.
data-bind='click: function (){...}'
will fail) - Can be used with Content-Security-Policy
unsafe-eval
- No longer uses
with
statements - No longer uses
eval
/new Function
- support template literals (``) in bindings (even in legacy browsers)
==
and===
use===
for comparison (same for!=
and!==
); fuzzy equality ~== / ~!= for the evil twins- add the
@
prefix operator that calls/unwrap functions (i.e.obs()()
is the same as@obs
)
- add "naked"
-
incorporate punches
{{ }}
and{{{}}}
text and attribute interpolation -
utils
- utils.domNodeDisposal is now exposed as domNodeDisposal
- arguments to setHtml that are functions are called (not just observables)
- cleanExternalData now exposed in domNodeDisposal.otherNodeCleanerFunctions
-
error handling
- onError no longer throws if overloaded; default function is to re-throw.
- error is thrown when an extender is not found
-
bindings
- add
<!-- else -->
inside theif
binding, and add anelse
binding (following the brianmhunt/knockout-else plugin) - add
hidden
binding (knockout/knockut#2103) using
binding in tko.binding.corehtml
binding in virtual elements (from punches)- punches-like
value|filter
filtering - incorporate punches namespacing i.e.
data-bind='event.click: => thing(true)'
is equivalent todata-bind='event: {click: => thing(true)}'
- add
-
bindng handler updates
- the
valueAccessor
passed to a binding handler is now callable, the first argument being a 'setter' of the object property or observable (this replacestwoWayBinding
) allowVirtualElements
can now be set with a property on a bindingHandler
- the
-
Updated preprocessor API
-
Deprecated
- Template binding options are deprecated
- expressionWriting (twoWayBinding)
- β.β in binding handler names
- jsonExpressionRewriting (expressionRewriting)
- form parsing
bind
shim- ko.utils.parseJson
- getFormFields
- fieldsIncludedWithJsonPost
- postJson