@tko/utils 4.0.0-beta1.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.js +39 -35
- package/dist/array.js.map +2 -2
- package/dist/async.js +4 -3
- package/dist/async.js.map +2 -2
- package/dist/css.js +5 -4
- package/dist/css.js.map +2 -2
- package/dist/dom/data.js +36 -46
- package/dist/dom/data.js.map +2 -2
- package/dist/dom/disposal.js +23 -16
- package/dist/dom/disposal.js.map +2 -2
- package/dist/dom/event.js +39 -41
- package/dist/dom/event.js.map +2 -2
- package/dist/dom/fixes.js +5 -24
- package/dist/dom/fixes.js.map +2 -2
- package/dist/dom/html.js +46 -61
- package/dist/dom/html.js.map +2 -2
- package/dist/dom/info.js +10 -8
- package/dist/dom/info.js.map +2 -2
- package/dist/dom/manipulation.js +16 -24
- package/dist/dom/manipulation.js.map +2 -2
- package/dist/dom/selectExtensions.js +33 -23
- package/dist/dom/selectExtensions.js.map +2 -2
- package/dist/dom/virtualElements.js +40 -32
- package/dist/dom/virtualElements.js.map +3 -3
- package/dist/error.js +2 -1
- package/dist/error.js.map +2 -2
- package/dist/function.js +2 -1
- package/dist/function.js.map +2 -2
- package/dist/index.cjs +446 -449
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +2 -3
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +2 -3
- package/dist/index.mjs.map +2 -2
- package/dist/memoization.js +18 -13
- package/dist/memoization.js.map +3 -3
- package/dist/object.js +10 -8
- package/dist/object.js.map +2 -2
- package/dist/options.js +97 -35
- package/dist/options.js.map +2 -2
- package/dist/string.js +3 -5
- package/dist/string.js.map +2 -2
- package/dist/symbol.js +3 -2
- package/dist/symbol.js.map +2 -2
- package/dist/tasks.js +10 -20
- package/dist/tasks.js.map +2 -2
- package/helpers/jasmine-13-helper.ts +198 -147
- package/package.json +2 -3
- package/LICENSE +0 -22
- package/dist/bind-shim.js +0 -18
- package/dist/bind-shim.js.map +0 -7
- package/dist/ie.js +0 -15
- package/dist/ie.js.map +0 -7
- package/dist/jquery.js +0 -6
- package/dist/jquery.js.map +0 -7
|
@@ -1,207 +1,258 @@
|
|
|
1
|
+
/// <reference types="jasmine" />
|
|
2
|
+
|
|
3
|
+
import jQuery from 'jquery'
|
|
4
|
+
window.jQuery = jQuery
|
|
5
|
+
|
|
1
6
|
/*
|
|
2
7
|
* Configure the Jasmine testing framework.
|
|
3
8
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
arrayMap, arrayFilter, ieVersion, selectExtensions, hasOwnProperty
|
|
8
|
-
} from '../dist/'
|
|
9
|
+
/* globals runs, waitsFor, jasmine */
|
|
9
10
|
|
|
11
|
+
import { arrayMap, arrayFilter, selectExtensions, hasOwnProperty, options } from '../dist/'
|
|
10
12
|
|
|
11
|
-
window.DEBUG = true
|
|
12
|
-
window.amdRequire = window.require
|
|
13
|
+
window.DEBUG = true
|
|
14
|
+
window.amdRequire = window.require
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
// window.jQuery with 'undefined' on IE < 9
|
|
16
|
-
window.jQueryInstance = window.jQuery;
|
|
17
|
-
|
|
18
|
-
// export var testNode;
|
|
19
|
-
jasmine.updateInterval = 500;
|
|
16
|
+
jasmine.updateInterval = 500
|
|
20
17
|
|
|
21
18
|
/*
|
|
22
19
|
Some helper functions for jasmine on the browser
|
|
23
20
|
*/
|
|
24
|
-
jasmine.resolve = function (promise) {
|
|
21
|
+
jasmine.resolve = function (promise: Promise<boolean>) {
|
|
25
22
|
let complete = false
|
|
26
|
-
runs(() =>
|
|
23
|
+
runs(() =>
|
|
24
|
+
promise.then(result => {
|
|
25
|
+
complete = result || true
|
|
26
|
+
})
|
|
27
|
+
)
|
|
27
28
|
waitsFor(() => complete)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
jasmine.prepareTestNode = function() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
document.body.appendChild(window.testNode);
|
|
39
|
-
};
|
|
31
|
+
jasmine.prepareTestNode = function (): HTMLElement {
|
|
32
|
+
// The bindings specs make frequent use of this utility function to set up
|
|
33
|
+
// a clean new DOM node they can execute code against
|
|
34
|
+
const existingNode = document.getElementById('testNode')
|
|
35
|
+
if (existingNode !== null && existingNode.parentNode) existingNode.parentNode.removeChild(existingNode)
|
|
36
|
+
const testNode = document.createElement('div')
|
|
37
|
+
testNode.id = 'testNode'
|
|
38
|
+
document.body.appendChild(testNode)
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
40
|
+
return testNode
|
|
41
|
+
}
|
|
44
42
|
|
|
43
|
+
jasmine.Clock.mockScheduler = function (callback) {
|
|
44
|
+
setTimeout(callback, 0)
|
|
45
|
+
}
|
|
45
46
|
|
|
46
47
|
export function useMockForTasks(options) {
|
|
47
|
-
|
|
48
|
+
jasmine.Clock.useMock()
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
// Make sure tasks is using setTimeout so that it uses the mock clock
|
|
51
|
+
if (options.taskScheduler != jasmine.Clock.mockScheduler) {
|
|
52
|
+
jasmine.getEnv().currentSpec.restoreAfter(options, 'taskScheduler')
|
|
53
|
+
options.taskScheduler = jasmine.Clock.mockScheduler
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
jasmine.Spec.prototype.restoreAfter = function (object, propertyName) {
|
|
58
|
+
const originalValue = object[propertyName]
|
|
59
|
+
this.after(function () {
|
|
60
|
+
object[propertyName] = originalValue
|
|
61
|
+
})
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
jasmine.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
object[propertyName] = originalValue;
|
|
60
|
-
});
|
|
61
|
-
};
|
|
64
|
+
jasmine.nodeText = function (node) {
|
|
65
|
+
return node.nodeType === Node.TEXT_NODE ? node.data : 'textContent' in node ? node.textContent : node.innerText
|
|
66
|
+
}
|
|
62
67
|
|
|
63
|
-
jasmine.
|
|
64
|
-
return node.nodeType == 3 ? node.data : 'textContent' in node ? node.textContent : node.innerText;
|
|
65
|
-
};
|
|
68
|
+
jasmine.browserSupportsProtoAssignment = { __proto__: [] } instanceof Array
|
|
66
69
|
|
|
67
|
-
jasmine.
|
|
70
|
+
jasmine.setNodeText = function (node, text: string) {
|
|
71
|
+
if ('textContent' in node) {
|
|
72
|
+
node.textContent = text
|
|
73
|
+
} else {
|
|
74
|
+
node.innerText = text
|
|
75
|
+
}
|
|
76
|
+
}
|
|
68
77
|
|
|
78
|
+
function cleanedHtml(node) {
|
|
79
|
+
let cleanedHtml = node.innerHTML.toLowerCase().replace(/\r\n/g, '')
|
|
80
|
+
// IE < 9 strips whitespace immediately following comment nodes. Normalize by doing the same on all browsers.
|
|
81
|
+
cleanedHtml = cleanedHtml.replace(/(<!--.*?-->)\s*/g, '$1')
|
|
82
|
+
// Also remove __ko__ expando properties (for DOM data) - most browsers hide these anyway but IE < 9 includes them in innerHTML
|
|
83
|
+
cleanedHtml = cleanedHtml.replace(/ __ko__\d+=\"(ko\d+|null)\"/g, '')
|
|
84
|
+
return cleanedHtml
|
|
85
|
+
}
|
|
69
86
|
|
|
70
|
-
jasmine.ieVersion = ieVersion;
|
|
71
87
|
/*
|
|
72
88
|
Custom Matchers
|
|
73
89
|
~~~~~~~~~~~~~~~
|
|
74
90
|
*/
|
|
75
|
-
|
|
91
|
+
const matchers = {
|
|
92
|
+
toHaveNodeTypes(expectedTypes) {
|
|
93
|
+
const values = arrayMap(this.actual, function (node) {
|
|
94
|
+
return node.nodeType
|
|
95
|
+
})
|
|
96
|
+
this.actual = values // Fix explanatory message
|
|
97
|
+
return this.env.equals_(values, expectedTypes)
|
|
98
|
+
},
|
|
76
99
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
100
|
+
toContainHtmlElementsAndText(expectedHtml) {
|
|
101
|
+
this.actual = cleanedHtml(this.actual).replace(/<!--.+?-->/g, '') // remove comments
|
|
102
|
+
return this.actual === expectedHtml
|
|
103
|
+
},
|
|
81
104
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
105
|
+
toContainText(expectedText, ignoreSpaces) {
|
|
106
|
+
if (ignoreSpaces) {
|
|
107
|
+
expectedText = expectedText.replace(/\s/g, '')
|
|
108
|
+
}
|
|
87
109
|
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
const actualText = jasmine.nodeText(this.actual)
|
|
111
|
+
let cleanedActualText = actualText.replace(/\r\n/g, '\n')
|
|
112
|
+
if (ignoreSpaces) {
|
|
113
|
+
cleanedActualText = cleanedActualText.replace(/\s/g, '')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.actual = cleanedActualText // Fix explanatory message
|
|
117
|
+
return cleanedActualText === expectedText
|
|
90
118
|
},
|
|
91
119
|
|
|
92
|
-
toHaveOwnProperties
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
120
|
+
toHaveOwnProperties(expectedProperties) {
|
|
121
|
+
const ownProperties = new Array()
|
|
122
|
+
for (const prop in this.actual) {
|
|
123
|
+
if (hasOwnProperty(this.actual, prop)) {
|
|
124
|
+
ownProperties.push(prop)
|
|
98
125
|
}
|
|
99
|
-
|
|
126
|
+
}
|
|
127
|
+
return this.env.equals_(ownProperties, expectedProperties)
|
|
100
128
|
},
|
|
101
129
|
|
|
102
|
-
toHaveTexts
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
130
|
+
toHaveTexts(expectedTexts) {
|
|
131
|
+
const texts = arrayMap(this.actual.childNodes, jasmine.nodeText)
|
|
132
|
+
this.actual = texts // Fix explanatory message
|
|
133
|
+
return this.env.equals_(texts, expectedTexts)
|
|
106
134
|
},
|
|
107
135
|
|
|
108
|
-
toHaveValues
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
toHaveValues(expectedValues) {
|
|
137
|
+
const values = arrayFilter(
|
|
138
|
+
arrayMap(this.actual.childNodes, node => node.value),
|
|
139
|
+
value => value !== undefined
|
|
140
|
+
)
|
|
141
|
+
this.actual = values // Fix explanatory message
|
|
142
|
+
return this.env.equals_(values, expectedValues)
|
|
114
143
|
},
|
|
115
144
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return this.env.equals_(values, expectedValues)
|
|
145
|
+
toHaveCheckedStates(expectedValues) {
|
|
146
|
+
const values = arrayMap(this.actual.childNodes, node => node.checked)
|
|
147
|
+
this.actual = values // Fix explanatory message
|
|
148
|
+
return this.env.equals_(values, expectedValues)
|
|
121
149
|
},
|
|
122
150
|
|
|
123
151
|
toThrowContaining(expected) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
152
|
+
let exception
|
|
153
|
+
try {
|
|
154
|
+
this.actual()
|
|
155
|
+
} catch (e) {
|
|
156
|
+
exception = e
|
|
157
|
+
}
|
|
158
|
+
const exceptionMessage = exception && (exception.message || exception)
|
|
159
|
+
|
|
160
|
+
this.message = function () {
|
|
161
|
+
const notText = this.isNot ? ' not' : ''
|
|
162
|
+
const expectation =
|
|
163
|
+
'Expected ' + this.actual.toString() + notText + " to throw exception containing '" + expected + "'"
|
|
164
|
+
const result = exception ? ", but it threw '" + exceptionMessage + "'" : ', but it did not throw anything'
|
|
165
|
+
return expectation + result
|
|
166
|
+
}
|
|
138
167
|
|
|
139
|
-
|
|
168
|
+
return exception ? this.env.contains_(exceptionMessage, expected) : false
|
|
140
169
|
},
|
|
141
170
|
|
|
142
|
-
toEqualOneOf
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
171
|
+
toEqualOneOf(expectedPossibilities) {
|
|
172
|
+
for (let i = 0; i < expectedPossibilities.length; i++) {
|
|
173
|
+
if (this.env.equals_(this.actual, expectedPossibilities[i])) {
|
|
174
|
+
return true
|
|
147
175
|
}
|
|
148
|
-
|
|
176
|
+
}
|
|
177
|
+
return false
|
|
149
178
|
},
|
|
150
179
|
|
|
151
|
-
toContainHtml
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
180
|
+
toContainHtml(expectedHtml, postProcessCleanedHtml) {
|
|
181
|
+
let cleanedHtml = this.actual.innerHTML.toLowerCase().replace(/\r\n/g, '')
|
|
182
|
+
// IE < 9 strips whitespace immediately following comment nodes. Normalize by doing the same on all browsers.
|
|
183
|
+
cleanedHtml = cleanedHtml.replace(/(<!--.*?-->)\s*/g, '$1')
|
|
184
|
+
expectedHtml = expectedHtml.replace(/(<!--.*?-->)\s*/g, '$1')
|
|
185
|
+
// Also remove __ko__ expando properties (for DOM data) - most browsers hide these anyway but IE < 9 includes them in innerHTML
|
|
186
|
+
cleanedHtml = cleanedHtml.replace(/ __ko__\d+=\"(ko\d+|null)\"/g, '')
|
|
187
|
+
if (postProcessCleanedHtml) {
|
|
188
|
+
cleanedHtml = postProcessCleanedHtml(cleanedHtml)
|
|
189
|
+
}
|
|
190
|
+
this.actual = cleanedHtml // Fix explanatory message
|
|
191
|
+
return cleanedHtml === expectedHtml
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
toHaveSelectedValues(expectedValues) {
|
|
195
|
+
const selectedNodes = arrayFilter(this.actual.childNodes, node => node.selected)
|
|
196
|
+
const selectedValues = arrayMap(selectedNodes, node => selectExtensions.readValue(node))
|
|
197
|
+
this.actual = selectedValues // Fix explanatory message
|
|
198
|
+
return this.env.equals_(selectedValues, expectedValues)
|
|
163
199
|
}
|
|
164
200
|
}
|
|
165
201
|
|
|
166
202
|
//
|
|
167
203
|
// bmh: Monkeypatch so we can catch errors in asynchronous functions.
|
|
168
204
|
//
|
|
169
|
-
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
205
|
+
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function (oldMillis, nowMillis) {
|
|
206
|
+
let scheduledFunc
|
|
207
|
+
const funcsToRun = new Array()
|
|
208
|
+
for (const timeoutKey in this.scheduledFunctions) {
|
|
209
|
+
scheduledFunc = this.scheduledFunctions[timeoutKey]
|
|
210
|
+
if (
|
|
211
|
+
scheduledFunc != jasmine.undefined
|
|
212
|
+
&& scheduledFunc.runAtMillis >= oldMillis
|
|
213
|
+
&& scheduledFunc.runAtMillis <= nowMillis
|
|
214
|
+
) {
|
|
215
|
+
funcsToRun.push(scheduledFunc)
|
|
216
|
+
this.scheduledFunctions[timeoutKey] = jasmine.undefined
|
|
180
217
|
}
|
|
218
|
+
}
|
|
181
219
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
//} catch(e) {
|
|
199
|
-
//}
|
|
200
|
-
}
|
|
201
|
-
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
|
220
|
+
if (funcsToRun.length > 0) {
|
|
221
|
+
funcsToRun.sort(function (a: any, b: any) {
|
|
222
|
+
return a.runAtMillis - b.runAtMillis
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
for (let i = 0; i < funcsToRun.length; ++i) {
|
|
226
|
+
//try { // mbest: Removed so we can catch errors in asynchronous functions
|
|
227
|
+
const funcToRun = funcsToRun[i]
|
|
228
|
+
this.nowMillis = funcToRun.runAtMillis
|
|
229
|
+
funcToRun.funcToCall()
|
|
230
|
+
if (funcToRun.recurring) {
|
|
231
|
+
this.scheduleFunction(funcToRun.timeoutKey, funcToRun.funcToCall, funcToRun.millis, true)
|
|
232
|
+
}
|
|
233
|
+
//} catch(e) {
|
|
234
|
+
//}
|
|
202
235
|
}
|
|
203
|
-
|
|
236
|
+
this.runFunctionsWithinRange(oldMillis, nowMillis)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
204
239
|
|
|
205
|
-
beforeEach(function() {
|
|
206
|
-
|
|
207
|
-
|
|
240
|
+
beforeEach(function () {
|
|
241
|
+
this.addMatchers(matchers)
|
|
242
|
+
|
|
243
|
+
switchJQueryState()
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
afterEach(function () {
|
|
247
|
+
expect(disableJQueryUsage).toEqual(options.disableJQueryUsage)
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
const KARMA_STRING = '__karma__'
|
|
251
|
+
let disableJQueryUsage = true
|
|
252
|
+
function switchJQueryState() {
|
|
253
|
+
if (window[KARMA_STRING] && window[KARMA_STRING].config.args.includes('--noJQuery')) {
|
|
254
|
+
options.disableJQueryUsage = disableJQueryUsage = true
|
|
255
|
+
} else {
|
|
256
|
+
options.disableJQueryUsage = disableJQueryUsage = false
|
|
257
|
+
}
|
|
258
|
+
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.0
|
|
2
|
+
"version": "4.0.0",
|
|
3
3
|
"name": "@tko/utils",
|
|
4
4
|
"description": "TKO Utilities",
|
|
5
5
|
"type": "module",
|
|
@@ -42,6 +42,5 @@
|
|
|
42
42
|
"import": "./dist/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./helpers/*": "./helpers/*"
|
|
45
|
-
}
|
|
46
|
-
"gitHead": "a8843acb8ae085915115e53a4e057b30731c635e"
|
|
45
|
+
}
|
|
47
46
|
}
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php
|
|
2
|
-
|
|
3
|
-
Copyright (c) Steven Sanderson, the Knockout.js team, and other contributors
|
|
4
|
-
http://knockoutjs.com/
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in
|
|
14
|
-
all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
THE SOFTWARE.
|
package/dist/bind-shim.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @tko/utils 🥊 4.0.0-beta1.3 ESM
|
|
2
|
-
if (!Function.prototype["bind"]) {
|
|
3
|
-
Function.prototype["bind"] = function(object) {
|
|
4
|
-
var originalFunction = this;
|
|
5
|
-
if (arguments.length === 1) {
|
|
6
|
-
return function() {
|
|
7
|
-
return originalFunction.apply(object, arguments);
|
|
8
|
-
};
|
|
9
|
-
} else {
|
|
10
|
-
var partialArgs = Array.prototype.slice.call(arguments, 1);
|
|
11
|
-
return function() {
|
|
12
|
-
var args = partialArgs.slice(0);
|
|
13
|
-
args.push.apply(args, arguments);
|
|
14
|
-
return originalFunction.apply(object, args);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
package/dist/bind-shim.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/bind-shim.ts"],
|
|
4
|
-
"sourcesContent": ["\nif (!Function.prototype['bind']) {\n // Shim/polyfill JavaScript Function.bind.\n // This implementation is based on the one in prototype.js\n Function.prototype['bind'] = function (object) {\n var originalFunction = this\n if (arguments.length === 1) {\n return function () {\n return originalFunction.apply(object, arguments)\n }\n } else {\n var partialArgs = Array.prototype.slice.call(arguments, 1)\n return function () {\n var args = partialArgs.slice(0)\n args.push.apply(args, arguments)\n return originalFunction.apply(object, args)\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";AACA,IAAI,CAAC,SAAS,UAAU,SAAS;AAG/B,WAAS,UAAU,UAAU,SAAU,QAAQ;AAC7C,QAAI,mBAAmB;AACvB,QAAI,UAAU,WAAW,GAAG;AAC1B,aAAO,WAAY;AACjB,eAAO,iBAAiB,MAAM,QAAQ,SAAS;AAAA,MACjD;AAAA,IACF,OAAO;AACL,UAAI,cAAc,MAAM,UAAU,MAAM,KAAK,WAAW,CAAC;AACzD,aAAO,WAAY;AACjB,YAAI,OAAO,YAAY,MAAM,CAAC;AAC9B,aAAK,KAAK,MAAM,MAAM,SAAS;AAC/B,eAAO,iBAAiB,MAAM,QAAQ,IAAI;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/ie.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @tko/utils 🥊 4.0.0-beta1.3 ESM
|
|
2
|
-
import options from "./options";
|
|
3
|
-
const ieVersion = options.document && function() {
|
|
4
|
-
var version = 3, div = options.document.createElement("div"), iElems = div.getElementsByTagName("i");
|
|
5
|
-
while (div.innerHTML = "<!--[if gt IE " + ++version + "]><i></i><![endif]-->", iElems[0]) {
|
|
6
|
-
}
|
|
7
|
-
if (!version) {
|
|
8
|
-
const userAgent = window.navigator.userAgent;
|
|
9
|
-
return ua.match(/MSIE ([^ ]+)/) || ua.match(/rv:([^ )]+)/);
|
|
10
|
-
}
|
|
11
|
-
return version > 4 ? version : void 0;
|
|
12
|
-
}();
|
|
13
|
-
const isIe6 = ieVersion === 6;
|
|
14
|
-
const isIe7 = ieVersion === 7;
|
|
15
|
-
export { ieVersion, isIe6, isIe7 };
|
package/dist/ie.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/ie.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Detection and Workarounds for Internet Explorer\n//\nimport options from './options'\n\nconst ieVersion = options.document && (function () {\n var version = 3, div = options.document.createElement('div'), iElems = div.getElementsByTagName('i')\n\n // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment\n while (\n div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',\n iElems[0]\n ) {}\n\n if (!version) {\n const userAgent = window.navigator.userAgent\n // Detect IE 10/11\n return ua.match(/MSIE ([^ ]+)/) || ua.match(/rv:([^ )]+)/)\n }\n return version > 4 ? version : undefined\n}())\n\nconst isIe6 = ieVersion === 6\nconst isIe7 = ieVersion === 7\n\nexport { ieVersion, isIe6, isIe7 }\n"],
|
|
5
|
-
"mappings": ";AAGA;AAEA,MAAM,YAAY,QAAQ,YAAa,WAAY;AACjD,MAAI,UAAU,GAAG,MAAM,QAAQ,SAAS,cAAc,KAAK,GAAG,SAAS,IAAI,qBAAqB,GAAG;AAGnG,SACM,IAAI,YAAY,mBAAoB,EAAE,UAAW,yBACjD,OAAO,IACT;AAAA,EAAC;AAEL,MAAI,CAAC,SAAS;AACZ,UAAM,YAAY,OAAO,UAAU;AAEnC,WAAO,GAAG,MAAM,cAAc,KAAK,GAAG,MAAM,aAAa;AAAA,EAC3D;AACA,SAAO,UAAU,IAAI,UAAU;AACjC,EAAE;AAEF,MAAM,QAAQ,cAAc;AAC5B,MAAM,QAAQ,cAAc;AAE5B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/jquery.js
DELETED
package/dist/jquery.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/jquery.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// jQuery\n//\n// TODO: deprecate in favour of options.$\n\nimport options from './options'\n\nexport var jQueryInstance = options.global && options.global.jQuery\n\nexport function jQuerySetInstance (jquery) {\n options.jQuery = jQueryInstance = jquery\n}\n"],
|
|
5
|
-
"mappings": ";AAKA;AAEO,WAAI,iBAAiB,QAAQ,UAAU,QAAQ,OAAO;AAEtD,kCAA4B,QAAQ;AACzC,UAAQ,SAAS,iBAAiB;AACpC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|