- Fix
==and!=parser error in binding expressions (#290) โ precedence was lost when operators were overloaded in the reference build. - Add
ko.options.strictEqualitysetter โ configures whether==/!=use strict comparison in bindings. Reference build enables by default. - Add
defineOption()plugin API for extendingko.optionswith typed setters. - Add
.jsextensions to all ESM dist imports โ fixesERR_MODULE_NOT_FOUNDin Node's strict ESM resolver (#313). - Fix broken
modulefield in 22 package.json files pointing to non-existent dist paths (#308). - Replace ESLint + Prettier with Biome (27x faster lint + format).
- Replace Make + lerna with Bun scripts (0.3s clean build).
- Add README.md to all 26 npm packages.
- Add version badge to tko.io header.
- #202 Make TKO more type-safe @mcselle, @Auge19, @phillipc, @M-Kirchhoff, @brianmhunt
- #194 fix userAgent typo in IE check @phillipc
- #196 fix
**operator precedence @mcselle - #195 add docker container for headless tests, upgrade packages, README fixes @Auge19
- #222 & #255 enable noImplicitOverride, noImplicitReturns, strictBindCallApply and strictFunctionTypes for stricter typescript validation @phillipc
- #219 Make some security fixes and add an HTML sanitization hook to
options@phillipc - #216 & #217 adds eslint and prettier @phillipc
- #214 convert several classes to typescript @phillipc
- #215 make jquery disablable and fix the loader mechanism @phillipc
- #233 remove IE9 switches from TKO @phillipc
- Stabilize the full public
@tko/*package set on the 4.x line. - Publish stable
4.0.0entry points for@tko/build.knockoutand@tko/build.reference. - Validate GitHub Actions trusted publishing and npm provenance for public packages.
- Keep the Knockout-compatible build for migration-oriented apps, with the reference build as the recommended modular/TSX path.
- For migration context and package guidance, see the docs at https://tko.io and the Knockout 3.x to TKO guide.
- Fix bad import operation of packages/utils.parser
- Fix |filter1|filter2 filter2 not having root
- In the Knockout build, don't convert evil twins (
==/!=) to strict counterparts (===/!==)
- Make optional chaining the default for property lookups
- Support nullish coalescing
?? - Support optional chaining
?. - Support exponentiation operator
** - Pass
contextto mustache pipe filters asthis
- replace
objectLookupwithMapintoJSfor O(n) instead of O(nยฒ) computational complexity (#170 @felipesantoz) - fix equality comparison for select option values (#155/#163 @danieldickison)
- fix identifier set_value in parser (#157/#161 @danieldickison)
- remove mustache from text/attr bindings by default (#156 @danieldickison)
- knockout function rewrite improvements (#156 @danieldickison)
- change parsing algorithm to Shunting Yard (#151 @danieldickison)
- Switch to
esbuild(likely breaks existing imports/require/etc) - add
preventDefaultto event handler bindings - switch source to Typescript (but no types exported yet)
- change build.reference & build.knockout build export strategy
- make bindingGlobals empty by default (#165 @danieldickison)
- Fix JSX observable properties being overwritten with observed value on the NativeProvider
- Make the
NativeProviderless preemptive i.e. allow other bindings to proceed if there are no native (JSX) bindings. This meansdata-bindand other attributes can be used inside JSX.
- [Security] Make the
NativeProviderpreemptive so that observables passed to JSX won't be double-bound (preventing XSS attacks of the form<div>{jsxObservable}</div>wherejsxObservableis{{ some_variable }}).
- Queue JSX node cleaning in batches
- Fix
SlotBindingbeing called twice via JSX/Observables
- Add support for passing generators to JSX
- Fix parsing of objects with trailing commas (e.g.
{ a: 1, }) - Fix nested JSX observers not binding children
- Update build system (experimenting)
- Change JSX behaviour so Node instances in observables are not cloned. This behaviour allows injecting
HTMLCanvasElementinstances without losing the canvas content. - Fix case where JSX
computedvalue is initiallynullorundefined
- Make node cleaning upon removal with JSX asynchronous
- Add
createElementto thetkoreference build, that (essentially) mimicsReact.createElement - Fix and add test for
applyBindingsToNodebeing used in delegation (i.e. with computeds) - Fix typo in
ieAutoCompleteHackNeededforvaluebinding
- JSX now supports infinitely nestable observables/arrays
- JSX now uses
trackArrayChangesto give O(1) updates to arrays - LifeCycle::subscribe now binds to the current class instance
- The
tkopackage will now be published as@tko/build.reference, and knockout as@tko/build.knockout - Mass move of
tko.*to the@tkoorganization i.e.@tko/ - Test release
- Fix auto-unwrapping of Jsx attributes
- Allow JSX to be used with SVG elements, and respect xmlns attribute
- Refresh JSX node when it's subscribable
- Make
<slot>elements and JSX play better together - Fix JSX computed not working when returning an array of observables
- Fix futures resolving to observables
- Fix node subscriptions not being properly disposed
- (observable) When supported,
observable.lengthwill now be undefined (was0before), andobservableArray.lengthwill now be the length of the wrapped array - (observableArraty)
observableArrayis now iterable (has aSymbol.iteratorproperty) - (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
- (
eventbinding) 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 - (
eventbinding) Addthrottleanddebounceparameters - The
throttleanddebounceutilities now pass arguments to the target functions - (components) Allow Component-specific binding handlers from
component.prototype.getBindingHandler - (components) Issue a warning if
ignoreCustomElementWarningis not passed to a component registration and the component name is not usable for custom elements. - (observable) Removed
thenfromobservable.fnbecause it'll likely cause a lot of confusing issues with implicit unwrapping fromasyncfunctions. - (observable) Add
ko.proxyand related functionsko.proxy.peek(obj, prop),ko.proxy.isProxied(obj),ko.proxy.getObservable(obj, prop). - Fix missing
ko.whenandko.isObservableArray - Add
options.bindingStringPreparsersarray of functions that mutate binding strings before they are parsed - Parse ES2015 object initializer shorthands e.g.
{name}={name: name} - Expose
ko.computedContextas alias ofko.dependencyDetection - Support JSX for component templates, so the
templatecan consume the output of babel-plugin-transform-jsx - Support component template slots, much like those in Vue.js.
- Support
templateproperties on Component View models (previously they had to be static properties) - Numerous forward-ports from Knockout 3.x (#54)
- Expose
createViewModelon Components registered withComponent.register - Changed
Component.elementNametoComponent.customElementNameand use a kebab-case version of the class name for the custom element name by default - Pass
{element, templateNodes}to theComponentconstructor as the second parameter of descendants of theComponentclass - Add support for
<ko binding='...'> - Add basic support for
ko.subscribableas TC39-Observables
- (build) Change the
tkoexport toglobal.kofor 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
koin node - (components) Add
getBindingHandler(key)to use binding handlers local to a component - (docs) Add
/tko.iowith 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, andnextfunctions - (parser) Fix early-out for logical (&& / ||) operators
- (binding)
ko.applyBindingsnow returns a Promise that resolves when bindings are completed - (attr) Support namespaced attributes with
attrbinding #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
stylesattribute (e.g.style="color: {{color}}") in theAttributeMustacheProvider, by addingattributesBindingMapparameter.
- (API) Expose
dependencyDetection.ignoreasignoreDependencies - (foreach binding) When using the
asparameter, the$dataremains unchanged (i.e. the context inside aforeachis no longer a "child" context, but an extension of the current context); this deprecates thenoContextparameter - (foreach binding) Expose the
conditionalon thedomDatafor use by theelsebinding (when the array is empty, theelsebinding will be rendered) - (foreach binding) Expose
$listinside the foreach - (foreach binding) Allow
noIndexas 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.
-1work, as well as variables-xand expressions-(x + y) -
Use tko.binding.foreach for the
foreachbinding (based on brianmhunt/knockout-fast-foreach) -
Add
eachas an alias offoreach -
Parser
- Correct behavior with dereferencing members of expressions (e.g.
(x || y).zor(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 behavior 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
templatebinding expose a conditional for else-binding -
Expose ko.dependencyDetection
-
Make sure
obj.xusesthisofobjwherexis a function (e.g.click: model.onClickhasthisofmodel) -
Ensure
obj.xonly usesobjasthiswhenxis 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
withstatements - 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 theifbinding, and add anelsebinding (following the brianmhunt/knockout-else plugin) - add
hiddenbinding (knockout/knockut#2103) usingbinding in tko.binding.corehtmlbinding in virtual elements (from punches)- punches-like
value|filterfiltering - incorporate punches namespacing i.e.
data-bind='event.click: => thing(true)'is equivalent todata-bind='event: {click: => thing(true)}'
- add
-
bindng handler updates
- the
valueAccessorpassed to a binding handler is now callable, the first argument being a 'setter' of the object property or observable (this replacestwoWayBinding) allowVirtualElementscan 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
bindshim- ko.utils.parseJson
- getFormFields
- fieldsIncludedWithJsonPost
- postJson