Skip to content

Commit 7679abf

Browse files
committed
add support for jQuery 4.0
1 parent d3bcec8 commit 7679abf

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

__tests__/terminal.spec.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -3082,7 +3082,7 @@ describe('Terminal plugin', function() {
30823082
});
30833083
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
30843084
});
3085-
it('should render funtion that return promise', async () => {
3085+
it('should render function that return promise', async () => {
30863086
var term = $('<div/>').terminal($.noop, {
30873087
prompt: function() {
30883088
return Promise.resolve('>>>');
@@ -3091,7 +3091,7 @@ describe('Terminal plugin', function() {
30913091
await delay(10);
30923092
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
30933093
});
3094-
it('should render funtion that call callback', () => {
3094+
it('should render function that call callback', () => {
30953095
var term = $('<div/>').terminal($.noop, {
30963096
prompt: function(fn) {
30973097
fn('>>>');
@@ -4081,7 +4081,7 @@ describe('Terminal plugin', function() {
40814081
$.ajax = function(obj) {
40824082
function done() {
40834083
if (!canceled) {
4084-
if ($.isFunction(obj.success)) {
4084+
if (typeof obj.success === 'function') {
40854085
obj.success(response, 'OK', {
40864086
getResponseHeader: function(header) {
40874087
if (header == 'Content-Type') {
@@ -4104,7 +4104,7 @@ describe('Terminal plugin', function() {
41044104
};
41054105
$(document).trigger("ajaxSend", [ jqXHR, obj ] );
41064106
try {
4107-
if ($.isFunction(obj.beforeSend)) {
4107+
if (typeof obj.beforeSend === 'function') {
41084108
obj.beforeSend({}, obj);
41094109
}
41104110
if (options.async) {
@@ -4142,7 +4142,7 @@ describe('Terminal plugin', function() {
41424142
var proc = {
41434143
name: key
41444144
};
4145-
if ($.isFunction(object[key])) {
4145+
if (typeof object[key] === 'function') {
41464146
var re = /function[^\(]+\(([^\)]+)\)/;
41474147
var m = object[key].toString().match(re);
41484148
if (m) {
@@ -4153,7 +4153,7 @@ describe('Terminal plugin', function() {
41534153
}
41544154
$.ajax = function(obj) {
41554155
function done() {
4156-
if ($.isFunction(obj.success)) {
4156+
if (typeof obj.success === 'function') {
41574157
obj.success(resp, 'OK', {
41584158
getResponseHeader: function(header) {
41594159
if (header == 'Content-Type') {
@@ -4192,7 +4192,7 @@ describe('Terminal plugin', function() {
41924192
var error = null;
41934193
var ret = null;
41944194
try {
4195-
if ($.isFunction(object[req.method])) {
4195+
if (typeof object[req.method] === 'function') {
41964196
ret = object[req.method].apply(null, req.params);
41974197
} else {
41984198
ret = null;
@@ -5566,7 +5566,7 @@ describe('Terminal plugin', function() {
55665566
var term = $('<div/>').appendTo('body').terminal(interpreter);
55675567
expect(term.commands()).toEqual(interpreter);
55685568
term.push('/test');
5569-
expect($.isFunction(term.commands())).toEqual(true);
5569+
expect(typeof term.commands() === 'function').toEqual(true);
55705570
term.destroy().remove();
55715571
});
55725572
});

js/jquery.terminal-src.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@
283283
clone_object: function(object) {
284284
var tmp = {};
285285
if (typeof object === 'object') {
286-
if ($.isArray(object)) {
286+
if (Array.isArray(object)) {
287287
return this.clone_array(object);
288288
} else if (object === null) {
289289
return object;
290290
} else {
291291
for (var key in object) {
292-
if ($.isArray(object[key])) {
292+
if (Array.isArray(object[key])) {
293293
tmp[key] = this.clone_array(object[key]);
294294
} else if (typeof object[key] === 'object') {
295295
tmp[key] = this.clone_object(object[key]);
@@ -625,7 +625,7 @@
625625
if (value === undefined || value === null) {
626626
return null;
627627
}
628-
var result = this.regex.exec(jQuery.trim(value.toString()));
628+
var result = this.regex.exec(value.toString().trim());
629629
if (result[2]) {
630630
var num = parseInt(result[1], 10);
631631
var mult = this.powers[result[2]] || 1;
@@ -637,7 +637,7 @@
637637
add: function(element, interval, label, fn, times, belay) {
638638
var counter = 0;
639639

640-
if (jQuery.isFunction(label)) {
640+
if (typeof label === 'function') {
641641
if (!times) {
642642
times = fn;
643643
}
@@ -7107,7 +7107,7 @@
71077107
};
71087108
}
71097109
function validJSONRPC(response) {
7110-
return $.isNumeric(response.id) &&
7110+
return typeof response.id === 'number' &&
71117111
(typeof response.result !== 'undefined' ||
71127112
typeof response.error !== 'undefined');
71137113
}
@@ -8102,7 +8102,7 @@
81028102
object = {
81038103
interpreter: make_basic_json_rpc(user_intrp, login)
81048104
};
8105-
if ($.isArray(settings.completion)) {
8105+
if (Array.isArray(settings.completion)) {
81068106
object.completion = settings.completion;
81078107
}
81088108
finalize(object);
@@ -9410,7 +9410,7 @@
94109410
// will be used internaly since users know
94119411
// when login success (they decide when
94129412
// it happen by calling the callback -
9413-
// this funtion)
9413+
// this function)
94149414
if (is_function(next)) {
94159415
next();
94169416
}
@@ -9611,7 +9611,7 @@
96119611
} else {
96129612
save_state.push(self.export_view());
96139613
}
9614-
if (!$.isArray(hash_commands)) {
9614+
if (!Array.isArray(hash_commands)) {
96159615
hash_commands = [];
96169616
}
96179617
if (command !== undefined && !ignore_hash) {
@@ -9665,7 +9665,7 @@
96659665
}
96669666
var d = exec_settings.deferred;
96679667
cmd_ready(function ready() {
9668-
if ($.isArray(command)) {
9668+
if (Array.isArray(command)) {
96699669
(function recur() {
96709670
var cmd = command.shift();
96719671
if (cmd) {
@@ -11237,7 +11237,7 @@
1123711237
// result is object with interpreter and completion properties
1123811238
interpreters.push($.extend({}, ret, push_settings));
1123911239
if (push_settings.completion === true) {
11240-
if ($.isArray(ret.completion)) {
11240+
if (Array.isArray(ret.completion)) {
1124111241
interpreters.top().completion = ret.completion;
1124211242
} else if (!ret.completion) {
1124311243
interpreters.top().completion = false;

js/less.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
term.removeClass('terminal-less');
219219
$output.css('height', '');
220220
var exit = options.exit || options.onExit;
221-
if ($.isFunction(exit)) {
221+
if (typeof exit === 'function') {
222222
exit();
223223
}
224224
}
@@ -299,7 +299,7 @@
299299
});
300300
}
301301
}
302-
if ($.isFunction(text)) {
302+
if (typeof text === 'function') {
303303
text(cols, run);
304304
} else {
305305
run(text);

package-lock.json

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,10 @@
367367
},
368368
"dependencies": {
369369
"@jcubic/lily": "^0.3.0",
370-
"@types/jquery": "^3.5.14",
370+
"@types/jquery": "^3.5.29",
371371
"ansidec": "^0.3.4",
372372
"iconv-lite": "^0.6.3",
373-
"jquery": "^3.6.0",
373+
"jquery": "^4.0.0-beta",
374374
"prismjs": "^1.27.0",
375375
"wcwidth": "^1.0.1"
376376
},

0 commit comments

Comments
 (0)