Skip to content

Commit 9c6f5b5

Browse files
authored
Merge branch 'knockout:main' into add_knip
2 parents 602ac34 + 40ac9a6 commit 9c6f5b5

File tree

9 files changed

+62
-65
lines changed

9 files changed

+62
-65
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ For TODO between alpha and release, see https://github.com/knockout/tko/issues/1
55
- #194 fix userAgent typo in IE check @phillipc
66
- #196 fix `**` operator precedence @mcselle
77
- #195 add docker container for headless tests, upgrade packages, README fixes @Auge19
8+
- #222 & #255 enable noImplicitOverride, noImplicitReturns, strictBindCallApply and strictFunctionTypes for stricter typescript validation @phillipc
9+
- #219 Make some security fixes and add an HTML sanitization hook to `options` @phillipc
10+
- #216 & #217 adds eslint and prettier @phillipc
11+
- #214 convert several classes to typescript @phillipc
12+
- #215 make jquery disablable and fix the loader mechanism @phillipc
13+
- #233 remove IE9 switches from TKO @phillipc
814

915
## Beta 1.7
1016

COVERAGE.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Coverage-Report
2-
Date: 2025-12-29
2+
Date: 2026-01-10
33

44
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
55
--------------------------------------|---------|----------|---------|---------|--------------------
6-
All files | 88.21 | 80.71 | 84.94 | 88.15 |
6+
All files | 89.73 | 83.31 | 86.25 | 89.77 |
77
builds/reference/src | 71.42 | 100 | 0 | 100 |
88
index.ts | 71.42 | 100 | 0 | 100 |
9-
packages/bind/dist | 96.16 | 89.4 | 96.55 | 96.05 |
9+
packages/bind/dist | 96.37 | 90.78 | 96.55 | 96.27 |
1010
BindingHandler.js | 93.33 | 75 | 84.61 | 93.1 | 32,47
1111
BindingResult.js | 100 | 100 | 100 | 100 |
1212
DescendantBindingHandler.js | 100 | 100 | 100 | 100 |
1313
LegacyBindingHandler.js | 95.12 | 88.88 | 92.3 | 95.12 | 9,89
14-
applyBindings.js | 93.58 | 84.61 | 100 | 93.4 | ...316,319,336-343
14+
applyBindings.js | 94.11 | 87.5 | 100 | 93.95 | ...316,319,336-343
1515
arrayToDomNodeChildren.js | 99.08 | 97.5 | 100 | 99.01 | 51
1616
bindingContext.js | 98.52 | 93.18 | 100 | 98.52 | 26
1717
bindingEvent.js | 100 | 100 | 100 | 100 |
@@ -25,27 +25,27 @@ All files | 88.21 | 80.71 | 84.94 | 88.15 |
2525
componentBinding.js | 97.1 | 93.33 | 100 | 97.01 | 19,120
2626
index.js | 100 | 100 | 100 | 100 |
2727
slotBinding.js | 100 | 91.66 | 100 | 100 | 11
28-
packages/binding.core/dist | 90.12 | 83.33 | 82.22 | 90.68 |
28+
packages/binding.core/dist | 93.17 | 87.19 | 88.09 | 93.73 |
2929
attr.js | 94.73 | 87.5 | 100 | 94.73 | 15
3030
checked.js | 98.33 | 97.77 | 100 | 98.11 | 72
3131
click.js | 100 | 100 | 100 | 100 |
3232
css.js | 100 | 100 | 100 | 100 |
33-
descendantsComplete.js | 25 | 0 | 0 | 25 | 6-11
33+
descendantsComplete.js | 50 | 0 | 50 | 50 | 6-7
3434
enableDisable.js | 100 | 100 | 100 | 100 |
3535
event.js | 100 | 100 | 100 | 100 |
3636
hasfocus.js | 93.75 | 92.85 | 100 | 93.75 | 17,44
3737
html.js | 100 | 100 | 100 | 100 |
3838
index.js | 100 | 100 | 100 | 100 |
3939
let.js | 100 | 100 | 100 | 100 |
40-
options.js | 97.43 | 93.54 | 100 | 97.18 | 43,142
40+
options.js | 97.4 | 93.54 | 100 | 97.14 | 42,140
4141
selectedOptions.js | 100 | 100 | 100 | 100 |
4242
style.js | 93.75 | 83.33 | 100 | 93.33 | 14
4343
submit.js | 83.33 | 50 | 100 | 83.33 | 7,19
4444
text.js | 100 | 100 | 100 | 100 |
45-
textInput.js | 65.85 | 50.87 | 42.1 | 67.08 | ...122,127,132,137
45+
textInput.js | 79.03 | 58.69 | 53.84 | 80.32 | ...0,85,90,108-112
4646
uniqueName.js | 100 | 100 | 100 | 100 |
4747
using.js | 100 | 100 | 100 | 100 |
48-
value.js | 87.93 | 76.31 | 80 | 92.59 | 19-21,70
48+
value.js | 87.93 | 86.84 | 80 | 92.59 | 19-21,70
4949
visible.js | 100 | 100 | 100 | 100 |
5050
packages/binding.foreach/dist | 92.18 | 86.08 | 93.02 | 91.59 |
5151
foreach.js | 92.11 | 86.08 | 93.02 | 91.51 | ...290,332,404,416
@@ -56,12 +56,12 @@ All files | 88.21 | 80.71 | 84.94 | 88.15 |
5656
ifUnless.js | 100 | 100 | 100 | 100 |
5757
index.js | 100 | 100 | 100 | 100 |
5858
with.js | 100 | 85.71 | 100 | 100 | 18
59-
packages/binding.template/dist | 89.18 | 80.9 | 91.3 | 88.97 |
59+
packages/binding.template/dist | 93.3 | 89.52 | 91.3 | 93.2 |
6060
foreach.js | 100 | 100 | 100 | 100 |
6161
index.js | 100 | 100 | 100 | 100 |
62-
nativeTemplateEngine.js | 86.66 | 41.66 | 100 | 84.61 | 13,19
62+
nativeTemplateEngine.js | 80 | 50 | 100 | 80 | 15-16
6363
templateEngine.js | 75 | 66.66 | 60 | 75 | 9-12,19,27
64-
templateSources.js | 67.39 | 57.5 | 87.5 | 65.11 | 31-42,48-58
64+
templateSources.js | 91.3 | 90 | 87.5 | 90.47 | 32,39-42
6565
templating.js | 95.97 | 91.85 | 96.66 | 95.97 | ...111,179-180,236
6666
packages/binding.template/helpers | 77.55 | 65.62 | 70 | 78.26 |
6767
dummyTemplateEngine.ts | 77.55 | 65.62 | 70 | 78.26 | ...39,73,97-99,102
@@ -76,8 +76,8 @@ All files | 88.21 | 80.71 | 84.94 | 88.15 |
7676
index.js | 96.42 | 100 | 87.5 | 96.15 | 55
7777
packages/lifecycle/dist | 79.59 | 68 | 90.9 | 78.72 |
7878
LifeCycle.js | 79.59 | 68 | 90.9 | 78.72 | ...,37,41,69-70,88
79-
packages/lifecycle/src | 87.5 | 64 | 90.9 | 89.13 |
80-
LifeCycle.ts | 87.5 | 64 | 90.9 | 89.13 | 29,48,80-81,101
79+
packages/lifecycle/src | 91.66 | 68 | 90.9 | 93.47 |
80+
LifeCycle.ts | 91.66 | 68 | 90.9 | 93.47 | 29,48,101
8181
packages/observable/dist | 96.39 | 92.99 | 93.04 | 96.78 |
8282
Subscription.js | 88.23 | 100 | 66.66 | 87.5 | 25-28
8383
defer.js | 93.33 | 50 | 100 | 93.33 | 6
@@ -104,13 +104,14 @@ All files | 88.21 | 80.71 | 84.94 | 88.15 |
104104
index.js | 100 | 100 | 100 | 100 |
105105
packages/provider.multi/dist | 100 | 92.3 | 100 | 100 |
106106
MultiProvider.js | 100 | 92.3 | 100 | 100 | 54
107-
packages/provider.mustache/dist | 66.36 | 63.15 | 50 | 67.92 |
107+
packages/provider.mustache/dist | 51.81 | 43.85 | 46.15 | 52.83 |
108108
AttributeMustacheProvider.js | 14.63 | 28 | 15.38 | 15.78 | 17-73
109-
TextMustacheProvider.js | 100 | 100 | 100 | 100 |
110-
mustacheParser.js | 95.83 | 86.95 | 77.77 | 95.83 | 17,53
111-
packages/provider.mustache/src | 69.66 | 54.16 | 81.81 | 69.31 |
109+
TextMustacheProvider.js | 90.47 | 77.77 | 100 | 90 | 14,23
110+
mustacheParser.js | 66.66 | 47.82 | 66.66 | 66.66 | ...,53-56,62-65,72
111+
packages/provider.mustache/src | 96.36 | 87.71 | 96.15 | 96.29 |
112112
AttributeMustacheProvider.ts | 90.24 | 84 | 92.3 | 90 | 46-49,100
113-
mustacheParser.ts | 52.08 | 21.73 | 66.66 | 52.08 | 14,24-54,65
113+
TextMustacheProvider.ts | 100 | 100 | 100 | 100 |
114+
mustacheParser.ts | 100 | 86.95 | 100 | 100 | 14-25,95
114115
packages/provider.native/dist | 100 | 91.66 | 100 | 100 |
115116
NativeProvider.js | 100 | 91.66 | 100 | 100 | 17
116117
packages/provider.virtual/dist | 100 | 72.72 | 100 | 100 |
@@ -148,30 +149,29 @@ All files | 88.21 | 80.71 | 84.94 | 88.15 |
148149
index.js | 90.9 | 0 | 100 | 90.9 | 13
149150
operators.js | 87.17 | 75 | 71.05 | 87.67 | ...66,76,86-89,115
150151
preparse.js | 100 | 100 | 100 | 100 |
151-
packages/utils/dist | 88.52 | 77.58 | 90.1 | 87.28 |
152+
packages/utils/dist | 90.95 | 81.98 | 91.95 | 90 |
152153
array.js | 92.38 | 88.31 | 93.75 | 92.04 | 50,71-77
153154
async.js | 100 | 100 | 100 | 100 |
154155
css.js | 61.11 | 44.44 | 66.66 | 56.25 | 15-26
155156
error.js | 90.9 | 0 | 100 | 90.9 | 6
156157
function.js | 88.88 | 100 | 75 | 87.5 | 9
157-
ie.js | 85.71 | 42.85 | 100 | 84.61 | 11-12
158158
index.js | 100 | 100 | 100 | 100 |
159159
memoization.js | 95.83 | 85.71 | 100 | 95.23 | 13,65
160160
object.js | 97.56 | 95.45 | 100 | 97.56 | 32
161161
options.js | 86.95 | 62.5 | 88.88 | 85.36 | 60-65,85
162162
string.js | 45.45 | 45.45 | 75 | 45.45 | 9,14-20
163163
symbol.js | 100 | 50 | 100 | 100 | 5
164-
tasks.js | 79.66 | 66.66 | 75 | 75 | 14-29
165-
packages/utils/dist/dom | 81.67 | 71.42 | 83.72 | 79.74 |
166-
data.js | 69.09 | 56.52 | 81.81 | 68.18 | 30-48
164+
tasks.js | 95.91 | 93.33 | 90 | 94.73 | 15-16
165+
packages/utils/dist/dom | 88.57 | 80.68 | 92 | 88.04 |
166+
data.js | 90.62 | 80 | 100 | 100 | 29,34,45
167167
disposal.js | 89.39 | 80 | 83.33 | 87.93 | 58,82,91-96,102
168-
event.js | 69.69 | 52.08 | 54.54 | 64.28 | ...67,71,75,99-106
169-
fixes.js | 75 | 62.5 | 100 | 74.07 | 27,34-36,42-44
170-
html.js | 69.3 | 60.37 | 63.63 | 60.81 | ...3,97-98,104,108
168+
event.js | 80.85 | 57.57 | 83.33 | 77.5 | ...-46,50,54,78-83
169+
fixes.js | 100 | 100 | 100 | 100 |
170+
html.js | 74.24 | 77.77 | 80 | 71.66 | ...,61,65-66,72,76
171171
info.js | 65.21 | 50 | 100 | 65.21 | 14-21,36,43
172-
manipulation.js | 90.24 | 75 | 100 | 88.57 | 47-50
172+
manipulation.js | 100 | 81.81 | 100 | 100 | 18,36
173173
selectExtensions.js | 97.82 | 96.96 | 100 | 97.61 | 30
174-
virtualElements.js | 94.11 | 87.05 | 94.73 | 94.16 | 145-151,180-181
175-
packages/utils/helpers | 90.07 | 69.44 | 94.28 | 89.51 |
176-
jasmine-13-helper.ts | 90.07 | 69.44 | 94.28 | 89.51 | ...167,179,233,258
174+
virtualElements.js | 93.98 | 91.78 | 94.73 | 94.06 | 143-149,178-179
175+
packages/utils/helpers | 90 | 69.44 | 94.28 | 89.43 |
176+
jasmine-13-helper.ts | 90 | 69.44 | 94.28 | 89.43 | ...165,177,231,256
177177

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ TKO aims to become a base for future versions of Knockout. The objectives inclu
9797
- CSP compliant
9898
- JSX/TSX support
9999

100-
## Zero-dependency and small sized - bundled only ~130KB
100+
## Zero-dependency and small sized - with all plugins, bundled only ~125KB
101101

102102
Created with https://esbuild.github.io/analyze/
103-
![Bundled only 130KB](assets/esbuild_analyzer.png)
103+
![Bundled only 125KB](assets/esbuild_analyzer.png)
104104

105105
## JQUERY and TKO
106106

assets/esbuild_analyzer.png

-14.9 KB
Loading

packages/binding.core/spec/selectedOptionsBehaviors.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ describe('Binding: Selected Options', function () {
4848

4949
it('Should update the model when selection in the SELECT node changes', function () {
5050
function setMultiSelectOptionSelectionState(optionElement, state) {
51-
// Workaround an IE 6 bug (http://benhollis.net/experiments/browserdemos/ie6-adding-options.html)
52-
if (/MSIE 6/i.test(navigator.userAgent)) {
53-
optionElement.setAttribute('selected', state)
54-
} else {
55-
optionElement.selected = state
56-
}
51+
optionElement.selected = state
5752
}
5853

5954
const cObject = {}
@@ -75,12 +70,7 @@ describe('Binding: Selected Options', function () {
7570

7671
it('Should update the model when selection in the SELECT node changes for non-observable property values', function () {
7772
function setMultiSelectOptionSelectionState(optionElement, state) {
78-
// Workaround an IE 6 bug (http://benhollis.net/experiments/browserdemos/ie6-adding-options.html)
79-
if (/MSIE 6/i.test(navigator.userAgent)) {
80-
optionElement.setAttribute('selected', state)
81-
} else {
82-
optionElement.selected = state
83-
}
73+
optionElement.selected = state
8474
}
8575

8676
const cObject = {}
@@ -103,12 +93,7 @@ describe('Binding: Selected Options', function () {
10393

10494
it('Should update the model when selection in the SELECT node inside an optgroup changes', function () {
10595
function setMultiSelectOptionSelectionState(optionElement, state) {
106-
// Workaround an IE 6 bug (http://benhollis.net/experiments/browserdemos/ie6-adding-options.html)
107-
if (/MSIE 6/i.test(navigator.userAgent)) {
108-
optionElement.setAttribute('selected', state)
109-
} else {
110-
optionElement.selected = state
111-
}
96+
optionElement.selected = state
11297
}
11398

11499
const selection = observableArray([])

packages/binding.core/spec/textInputBehaviors.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
/* global testNode */
22
import { applyBindings } from '@tko/bind'
3-
43
import { computed } from '@tko/computed'
5-
64
import { observable } from '@tko/observable'
7-
85
import { triggerEvent, options } from '@tko/utils'
9-
106
import { DataBindProvider } from '@tko/provider.databind'
11-
7+
import { MSIE_REGEX } from '../src/textInput'
128
import { bindings as coreBindings } from '../dist'
139

1410
const DEBUG = true
@@ -29,7 +25,7 @@ describe('Binding: TextInput', function () {
2925
bindingHandlers.set(coreBindings)
3026
})
3127

32-
it('User-Agent detection IE10 + IE11', function () {
28+
it('User-Agent detection for Internet Explorer', function () {
3329
let uaList = [
3430
{ agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0', version: 9 },
3531
{ agent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)', version: 10 },
@@ -52,9 +48,16 @@ describe('Binding: TextInput', function () {
5248
]
5349

5450
uaList.forEach(userAgent => {
55-
let match = userAgent['agent'].match(/MSIE ([^ ;]+)|rv:([^ )]+)/)
51+
let match = userAgent['agent'].match(MSIE_REGEX)
5652
let ieVersion = match && (parseFloat(match[1]) || parseFloat(match[2]))
5753
expect(ieVersion).toBe(userAgent['version'])
54+
55+
if (userAgent['version'] == null) {
56+
expect(match).toBeFalsy()
57+
} else {
58+
expect(match).toBeTruthy()
59+
expect(MSIE_REGEX.test(userAgent['agent'])).toBeTruthy()
60+
}
5861
})
5962
})
6063

packages/binding.core/spec/valueBehaviors.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,9 @@ describe('Binding: Value', function () {
286286
expect(myObservable()).toEqual('some value from the server')
287287
})
288288

289-
it('Should handle autofill selection by treating "propertychange" followed by "blur" as a change event', function () {
290-
// This spec !no longer! describes the awkward choreography of events needed to detect changes to text boxes on IE < 10,
291-
// because it doesn't fire regular "change" events when the user selects an autofill entry. It isn't applicable
292-
// on IE 10+ or other browsers, because they don't have that problem with autofill. We have change the test case, so it runs on modern browsers.
289+
it('Should handle autofill selection by treating "focus", "blur" and "change" event', function () {
290+
// We have change the test case, so it runs on modern browsers. Originally, this spec describes was a awkward choreography of events needed to detect changes to text boxes on IE < 10,
291+
// because it doesn't fire regular "change" events when the user selects an autofill entry.
293292

294293
const myObservable = observable(123).extend({ notify: 'always' })
295294
let numUpdates = 0

0 commit comments

Comments
 (0)