Skip to content

Commit

Permalink
refactor: remove deprecated jquery functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de authored and Sean committed Dec 7, 2018
1 parent d84fb23 commit ee4b02c
Show file tree
Hide file tree
Showing 23 changed files with 145 additions and 50 deletions.
6 changes: 5 additions & 1 deletion src/definitions/behaviors/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isWindow = $.isWindow || function(obj) {
return obj != null && obj === obj.window;
};

var
window = (typeof window != 'undefined' && window.Math == Math)
? window
Expand Down Expand Up @@ -990,7 +994,7 @@ $.api = $.fn.api = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
24 changes: 14 additions & 10 deletions src/definitions/behaviors/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -261,7 +265,7 @@ $.fn.form = function(parameters) {
},
// duck type rule test
shorthandRules: function(rules) {
return (typeof rules == 'string' || $.isArray(rules));
return (typeof rules == 'string' || Array.isArray(rules));
},
empty: function($field) {
if(!$field || $field.length === 0) {
Expand Down Expand Up @@ -566,7 +570,7 @@ $.fn.form = function(parameters) {
},
values: function (fields) {
var
$fields = $.isArray(fields)
$fields = Array.isArray(fields)
? module.get.fields(fields)
: $field,
values = {}
Expand Down Expand Up @@ -668,7 +672,7 @@ $.fn.form = function(parameters) {
newValidation = {}
;
if(module.is.shorthandRules(rules)) {
rules = $.isArray(rules)
rules = Array.isArray(rules)
? rules
: [rules]
;
Expand Down Expand Up @@ -751,7 +755,7 @@ $.fn.form = function(parameters) {
remove: {
rule: function(field, rule) {
var
rules = $.isArray(rule)
rules = Array.isArray(rule)
? rule
: [rule]
;
Expand All @@ -760,7 +764,7 @@ $.fn.form = function(parameters) {
validation[field].rules = [];
return;
}
if(validation[field] == undefined || !$.isArray(validation[field].rules)) {
if(validation[field] == undefined || !Array.isArray(validation[field].rules)) {
return;
}
$.each(validation[field].rules, function(index, rule) {
Expand All @@ -772,7 +776,7 @@ $.fn.form = function(parameters) {
},
field: function(field) {
var
fields = $.isArray(field)
fields = Array.isArray(field)
? field
: [field]
;
Expand All @@ -782,7 +786,7 @@ $.fn.form = function(parameters) {
},
// alias
rules: function(field, rules) {
if($.isArray(field)) {
if(Array.isArray(field)) {
$.each(fields, function(index, field) {
module.remove.rule(field, rules);
});
Expand Down Expand Up @@ -863,7 +867,7 @@ $.fn.form = function(parameters) {
var
$field = module.get.field(key),
$element = $field.parent(),
isMultiple = $.isArray(value),
isMultiple = Array.isArray(value),
isCheckbox = $element.is(selector.uiCheckbox),
isDropdown = $element.is(selector.uiDropdown),
isRadio = ($field.is(selector.radio) && isCheckbox),
Expand Down Expand Up @@ -1181,7 +1185,7 @@ $.fn.form = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down Expand Up @@ -1337,7 +1341,7 @@ $.fn.form.settings = {

// is not empty or blank string
empty: function(value) {
return !(value === undefined || '' === value || $.isArray(value) && value.length === 0);
return !(value === undefined || '' === value || Array.isArray(value) && value.length === 0);
},

// checkbox checked
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/behaviors/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

"use strict";

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -559,7 +563,7 @@ $.fn.state = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/behaviors/visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -1172,7 +1176,7 @@ $.fn.visibility = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/globals/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

;(function ($, window, document, undefined) {

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

$.site = $.fn.site = function(parameters) {
var
time = new Date().getTime(),
Expand Down Expand Up @@ -391,7 +395,7 @@ $.site = $.fn.site = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -522,7 +526,7 @@ $.fn.accordion = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/modules/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -1042,7 +1046,7 @@ $.fn.calendar = function(parameters) {
else if (found !== undefined) {
response = found;
}
if ($.isArray(returnedValue)) {
if (Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if (returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/modules/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -735,7 +739,7 @@ $.fn.checkbox = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -622,7 +626,7 @@ $.fn.dimmer = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
28 changes: 16 additions & 12 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

'use strict';

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -203,7 +207,7 @@ $.fn.dropdown = function(parameters) {
if(!values) {
return false;
}
values = $.isArray(values)
values = Array.isArray(values)
? values
: [values]
;
Expand Down Expand Up @@ -779,7 +783,7 @@ $.fn.dropdown = function(parameters) {
onSuccess : function(response) {
var
values = response[fields.remoteValues],
hasRemoteValues = ($.isArray(values) && values.length > 0)
hasRemoteValues = (Array.isArray(values) && values.length > 0)
;
if(hasRemoteValues) {
module.remove.message();
Expand Down Expand Up @@ -1759,7 +1763,7 @@ $.fn.dropdown = function(parameters) {
count
;
count = ( module.is.multiple() )
? $.isArray(values)
? Array.isArray(values)
? values.length
: 0
: (module.get.value() !== '')
Expand All @@ -1783,7 +1787,7 @@ $.fn.dropdown = function(parameters) {
if(!values) {
return false;
}
values = $.isArray(values)
values = Array.isArray(values)
? values
: [values]
;
Expand Down Expand Up @@ -1818,7 +1822,7 @@ $.fn.dropdown = function(parameters) {
value = ($input.length > 0)
? $input.val()
: $module.data(metadata.value),
isEmptyMultiselect = ($.isArray(value) && value.length === 1 && value[0] === '')
isEmptyMultiselect = (Array.isArray(value) && value.length === 1 && value[0] === '')
;
// prevents placeholder element from being selected when multiple
return (value === undefined || isEmptyMultiselect)
Expand Down Expand Up @@ -2009,7 +2013,7 @@ $.fn.dropdown = function(parameters) {
? (value.length > 0)
: (value !== undefined && value !== null)
;
isMultiple = (module.is.multiple() && $.isArray(value));
isMultiple = (module.is.multiple() && Array.isArray(value));
strict = (value === '' || value === 0)
? true
: strict || false
Expand Down Expand Up @@ -2842,7 +2846,7 @@ $.fn.dropdown = function(parameters) {
return;
}
// extend current array
if($.isArray(currentValue)) {
if(Array.isArray(currentValue)) {
newValue = currentValue.concat([addedValue]);
newValue = module.get.uniqueArray(newValue);
}
Expand Down Expand Up @@ -3027,7 +3031,7 @@ $.fn.dropdown = function(parameters) {
module.check.maxSelections();
},
arrayValue: function(removedValue, values) {
if( !$.isArray(values) ) {
if( !Array.isArray(values) ) {
values = [values];
}
values = $.grep(values, function(value){
Expand Down Expand Up @@ -3185,7 +3189,7 @@ $.fn.dropdown = function(parameters) {
valueMatchingCase: function(value) {
var
values = module.get.values(),
hasValue = $.isArray(values)
hasValue = Array.isArray(values)
? values && ($.inArray(value, values) !== -1)
: (values == value)
;
Expand All @@ -3199,7 +3203,7 @@ $.fn.dropdown = function(parameters) {
values = module.get.values(),
hasValue = false
;
if(!$.isArray(values)) {
if(!Array.isArray(values)) {
values = [values];
}
$.each(values, function(index, existingValue) {
Expand Down Expand Up @@ -3571,7 +3575,7 @@ $.fn.dropdown = function(parameters) {
escape: {
value: function(value) {
var
multipleValues = $.isArray(value),
multipleValues = Array.isArray(value),
stringValue = (typeof value === 'string'),
isUnparsable = (!stringValue && !multipleValues),
hasQuotes = (stringValue && value.search(regExp.quote) !== -1),
Expand Down Expand Up @@ -3745,7 +3749,7 @@ $.fn.dropdown = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
6 changes: 5 additions & 1 deletion src/definitions/modules/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

"use strict";

$.isFunction = $.isFunction || function(obj) {
return typeof obj === "function" && typeof obj.nodeType !== "number";
};

window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
Expand Down Expand Up @@ -541,7 +545,7 @@ $.fn.embed = function(parameters) {
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
if(Array.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
Expand Down
Loading

0 comments on commit ee4b02c

Please sign in to comment.