diff --git a/.eslintrc.js b/.eslintrc.js
index 63bf21aef7..c71a4d8810 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -91,7 +91,6 @@ module.exports = {
'guard-for-in': 'off', // refactor to "for of"
'no-restricted-globals': 'off',
'no-restricted-properties': 'off',
- 'no-var': 'off', // https://github.com/fomantic/Fomantic-UI/pull/2584
'one-var': 'off',
'prefer-const': 'off',
'prefer-exponentiation-operator': 'off',
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8ec5c13a3d..5a6128c614 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- node-version: [12, 14, 16, 18, latest]
+ node-version: [14, 16, 18, latest]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
diff --git a/package.json b/package.json
index 83abadd8a2..ae910ccf8f 100644
--- a/package.json
+++ b/package.json
@@ -86,7 +86,7 @@
"stylelint-config-standard": "^29.0.0"
},
"engines": {
- "node": ">=12",
+ "node": ">=14",
"npm": ">=6.14.8"
},
"title": "Fomantic UI",
diff --git a/src/definitions/behaviors/api.js b/src/definitions/behaviors/api.js
index 5704776e12..c1c2598290 100644
--- a/src/definitions/behaviors/api.js
+++ b/src/definitions/behaviors/api.js
@@ -24,7 +24,7 @@
: globalThis;
$.fn.api = function (parameters) {
- var
+ let
// use window context if none specified
$allModules = isFunction(this)
? $(window)
@@ -41,7 +41,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.api.settings, parameters)
: $.extend({}, $.fn.api.settings),
@@ -109,7 +109,7 @@
bind: {
events: function () {
- var
+ let
triggerEvent = module.get.event()
;
if (triggerEvent) {
@@ -140,7 +140,7 @@
read: {
cachedResponse: function (url) {
- var
+ let
response
;
if (window.Storage === undefined) {
@@ -346,7 +346,7 @@
add: {
urlData: function (url, urlData) {
- var
+ let
requiredVariables,
optionalVariables
;
@@ -357,7 +357,7 @@
if (requiredVariables) {
module.debug('Looking for required URL variables', requiredVariables);
$.each(requiredVariables, function (index, templatedString) {
- var
+ let
// allow legacy {$var} style
variable = templatedString.indexOf('$') !== -1
? templatedString.slice(2, -1)
@@ -388,7 +388,7 @@
if (optionalVariables) {
module.debug('Looking for optional URL variables', requiredVariables);
$.each(optionalVariables, function (index, templatedString) {
- var
+ let
// allow legacy {/$var} style
variable = templatedString.indexOf('$') !== -1
? templatedString.slice(3, -1)
@@ -419,7 +419,7 @@
return url;
},
formData: function (data) {
- var
+ let
formData = {},
hasOtherData,
useFormDataApi = settings.serializeForm === 'formdata'
@@ -432,7 +432,7 @@
settings.processData = settings.processData !== undefined ? settings.processData : false;
settings.contentType = settings.contentType !== undefined ? settings.contentType : false;
} else {
- var
+ let
formArray = $form.serializeArray(),
pushes = {},
pushValues = {},
@@ -452,7 +452,7 @@
if (!settings.regExp.validate.test(el.name)) {
return;
}
- var
+ let
isCheckbox = $('[name="' + el.name + '"]', $form).attr('type') === 'checkbox',
floatValue = parseFloat(el.value),
value = (isCheckbox && el.value === 'on')
@@ -476,7 +476,7 @@
}
while (nameKeys.length > 0) {
- var k = nameKeys.pop();
+ let k = nameKeys.pop();
if (k === '' && !Array.isArray(value)) { // foo[]
value = build([], pushes[pushKey]++, value);
@@ -534,7 +534,7 @@
// nothing special
},
done: function (response, textStatus, xhr) {
- var
+ let
context = this,
elapsedTime = Date.now() - requestStartTime,
timeLeft = settings.loadingDuration - elapsedTime,
@@ -563,7 +563,7 @@
}, timeLeft);
},
fail: function (xhr, status, httpMessage) {
- var
+ let
context = this,
elapsedTime = Date.now() - requestStartTime,
timeLeft = settings.loadingDuration - elapsedTime
@@ -593,7 +593,7 @@
settings.onSuccess.call(context, response, $module, xhr);
},
complete: function (firstParameter, secondParameter) {
- var
+ let
xhr,
response
;
@@ -609,7 +609,7 @@
settings.onComplete.call(context, response, $module, xhr);
},
fail: function (xhr, status, httpMessage) {
- var
+ let
// pull response from xhr if available
response = module.get.responseFromXHR(xhr),
errorMessage = module.get.errorFromRequest(response, status, httpMessage)
@@ -658,7 +658,7 @@
},
mockedXHR: function () {
- var
+ let
// xhr does not simulate these properties of xhr but must return them
textStatus = false,
status = false,
@@ -704,7 +704,7 @@
},
xhr: function () {
- var
+ let
xhr
;
// ajax request promise
@@ -767,7 +767,7 @@
return module.xhr || false;
},
settings: function () {
- var
+ let
runSettings
;
runSettings = settings.beforeSend.call($module, settings);
@@ -800,7 +800,7 @@
: $.extend(true, {}, settings);
},
urlEncodedValue: function (value) {
- var
+ let
decodedValue = window.decodeURIComponent(value),
encodedValue = window.encodeURIComponent(value),
alreadyEncoded = decodedValue !== value
@@ -815,7 +815,7 @@
return encodedValue;
},
defaultData: function () {
- var
+ let
data = {}
;
if (!isWindow(element)) {
@@ -877,7 +877,7 @@
},
abort: function () {
- var
+ let
xhr = module.get.xhr()
;
if (xhr && xhr.state() !== 'resolved') {
@@ -943,7 +943,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -964,7 +964,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -992,7 +992,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1004,7 +1004,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js
index d86c8fb619..e5a9b00b8b 100644
--- a/src/definitions/behaviors/form.js
+++ b/src/definitions/behaviors/form.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.form = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -34,7 +34,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
$module = $(this),
element = this,
@@ -159,7 +159,7 @@
$module.on('keydown' + eventNamespace, selector.field, module.event.field.keydown);
}
$field.each(function (index, el) {
- var
+ let
$input = $(el),
type = $input.prop('type'),
inputEvent = module.get.changeEvent(type, $input)
@@ -187,7 +187,7 @@
clear: function () {
$field.each(function (index, el) {
- var
+ let
$field = $(el),
$element = $field.parent(),
$fieldGroup = $field.closest($group),
@@ -221,7 +221,7 @@
reset: function () {
$field.each(function (index, el) {
- var
+ let
$field = $(el),
$element = $field.parent(),
$fieldGroup = $field.closest($group),
@@ -259,7 +259,7 @@
determine: {
isValid: function () {
- var
+ let
allValid = true
;
$.each(validation, function (fieldName, field) {
@@ -271,10 +271,10 @@
return allValid;
},
isDirty: function (e) {
- var formIsDirty = false;
+ let formIsDirty = false;
$field.each(function (index, el) {
- var
+ let
$el = $(el),
isCheckbox = $el.filter(selector.checkbox).length > 0,
isDirty
@@ -319,7 +319,7 @@
return String($field.val()).trim() === '';
},
valid: function (field, showErrors) {
- var
+ let
allValid = true
;
if (field) {
@@ -344,14 +344,14 @@
return !dirty;
},
fieldDirty: function ($el) {
- var initialValue = $el.data(metadata.defaultValue);
+ let initialValue = $el.data(metadata.defaultValue);
// Explicitly check for undefined/null here as value may be `false`, so ($el.data(dataInitialValue) || '') would not work
if (initialValue === undefined || initialValue === null) {
initialValue = '';
} else if (Array.isArray(initialValue)) {
initialValue = initialValue.toString();
}
- var currentValue = $el.val();
+ let currentValue = $el.val();
if (currentValue === undefined || currentValue === null) {
currentValue = '';
} else if (Array.isArray(currentValue)) {
@@ -359,10 +359,10 @@
currentValue = currentValue.toString();
}
// Boolean values can be encoded as "true/false" or "True/False" depending on underlying frameworks so we need a case insensitive comparison
- var boolRegex = /^(true|false)$/i;
- var isBoolValue = boolRegex.test(initialValue) && boolRegex.test(currentValue);
+ let boolRegex = /^(true|false)$/i;
+ let isBoolValue = boolRegex.test(initialValue) && boolRegex.test(currentValue);
if (isBoolValue) {
- var regex = new RegExp('^' + initialValue + '$', 'i');
+ let regex = new RegExp('^' + initialValue + '$', 'i');
return !regex.test(currentValue);
}
@@ -370,8 +370,8 @@
return currentValue !== initialValue;
},
checkboxDirty: function ($el) {
- var initialValue = $el.data(metadata.defaultValue);
- var currentValue = $el.is(':checked');
+ let initialValue = $el.data(metadata.defaultValue);
+ let currentValue = $el.is(':checked');
return initialValue !== currentValue;
},
@@ -392,7 +392,7 @@
event: {
field: {
keydown: function (event) {
- var
+ let
$field = $(this),
key = event.which,
isInput = $field.is(selector.input),
@@ -423,7 +423,7 @@
keyHeldDown = false;
},
blur: function (event) {
- var
+ let
$field = $(this),
$fieldGroup = $field.closest($group),
validationRules = module.get.validation($field)
@@ -437,7 +437,7 @@
}
},
change: function (event) {
- var
+ let
$field = $(this),
$fieldGroup = $field.closest($group),
validationRules = module.get.validation($field)
@@ -502,7 +502,7 @@
: 'keyup');
},
fieldsFromShorthand: function (fields) {
- var
+ let
fullFields = {}
;
$.each(fields, function (name, rules) {
@@ -524,7 +524,7 @@
return fullFields;
},
prompt: function (rule, field) {
- var
+ let
ruleName = module.get.ruleName(rule),
ancillary = module.get.ancillaryValue(rule),
$field = module.get.field(field.identifier),
@@ -572,7 +572,7 @@
},
settings: function () {
if ($.isPlainObject(parameters)) {
- var
+ let
keys = Object.keys(parameters),
isLegacySettings = keys.length > 0
? parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined
@@ -618,7 +618,7 @@
field: function (identifier) {
module.verbose('Finding field with identifier', identifier);
identifier = module.escape.string(identifier);
- var t;
+ let t;
t = $field.filter('#' + identifier);
if (t.length > 0) {
return t;
@@ -640,7 +640,7 @@
return $('');
},
fields: function (fields) {
- var
+ let
$fields = $()
;
$.each(fields, function (index, name) {
@@ -650,7 +650,7 @@
return $fields;
},
validation: function ($field) {
- var
+ let
fieldValidation,
identifier
;
@@ -672,7 +672,7 @@
return fieldValidation || false;
},
value: function (field) {
- var
+ let
fields = [],
results
;
@@ -682,14 +682,14 @@
return results[field];
},
values: function (fields) {
- var
+ let
$fields = Array.isArray(fields)
? module.get.fields(fields)
: $field,
values = {}
;
$fields.each(function (index, field) {
- var
+ let
$field = $(field),
$calendar = $field.closest(selector.uiCalendar),
name = $field.prop('name'),
@@ -727,7 +727,7 @@
} else if (isCheckbox) {
values[name] = isChecked ? value || true : false;
} else if (isCalendar) {
- var date = $calendar.calendar('get date');
+ let date = $calendar.calendar('get date');
if (date !== null) {
switch (settings.dateHandling) {
@@ -742,7 +742,7 @@
break;
}
case 'formatter': {
- var type = $calendar.calendar('setting', 'type');
+ let type = $calendar.calendar('setting', 'type');
switch (type) {
case 'date': {
@@ -847,7 +847,7 @@
rules: [],
};
}
- var
+ let
newValidation = {
rules: [],
}
@@ -878,7 +878,7 @@
module.refreshEvents();
},
prompt: function (identifier, errors, internal) {
- var
+ let
$field = module.get.field(identifier),
$fieldGroup = $field.closest($group),
$prompt = $fieldGroup.children(selector.prompt),
@@ -940,7 +940,7 @@
module.determine.isDirty();
},
rule: function (field, rule) {
- var
+ let
rules = Array.isArray(rule)
? rule
: [rule]
@@ -962,7 +962,7 @@
});
},
field: function (field) {
- var
+ let
fields = Array.isArray(field)
? field
: [field]
@@ -986,7 +986,7 @@
module.remove.field(fields);
},
prompt: function (identifier) {
- var
+ let
$field = module.get.field(identifier),
$fieldGroup = $field.closest($group),
$prompt = $fieldGroup.children(selector.prompt)
@@ -1020,7 +1020,7 @@
},
defaults: function () {
$field.each(function (index, el) {
- var
+ let
$el = $(el),
$parent = $el.parent(),
isCheckbox = $el.filter(selector.checkbox).length > 0,
@@ -1047,7 +1047,7 @@
;
},
value: function (field, value) {
- var
+ let
fields = {}
;
fields[field] = value;
@@ -1059,7 +1059,7 @@
return;
}
$.each(fields, function (key, value) {
- var
+ let
$field = module.get.field(key),
$element = $field.parent(),
$calendar = $field.closest(selector.uiCalendar),
@@ -1141,7 +1141,7 @@
autoCheck: function () {
module.debug('Enabling auto check on required fields');
$field.each(function (_index, el) {
- var
+ let
$el = $(el),
$elGroup = $el.closest($group),
isCheckbox = $el.filter(selector.checkbox).length > 0,
@@ -1179,7 +1179,7 @@
validate: {
form: function (event, ignoreCallbacks) {
- var values = module.get.values();
+ let values = module.get.values();
// input keydown event will fire submit repeatedly by browser default
if (keyHeldDown) {
@@ -1209,7 +1209,7 @@
event.stopImmediatePropagation();
}
if (settings.errorFocus && ignoreCallbacks !== true) {
- var
+ let
$focusElement,
hasTabIndex = true
;
@@ -1245,7 +1245,7 @@
fieldName = field;
field = validation[field];
}
- var
+ let
identifier = field.identifier || fieldName,
$field = module.get.field(identifier),
$dependsField = field.depends
@@ -1258,7 +1258,7 @@
module.debug('Using field name as identifier', identifier);
field.identifier = identifier;
}
- var isDisabled = $field.filter(':not(:disabled)').length === 0;
+ let isDisabled = $field.filter(':not(:disabled)').length === 0;
if (isDisabled) {
module.debug('Field is disabled. Skipping', identifier);
} else if (field.optional && module.is.blank($field)) {
@@ -1271,7 +1271,7 @@
}
$.each(field.rules, function (index, rule) {
if (module.has.field(identifier)) {
- var invalidFields = module.validate.rule(field, rule, true) || [];
+ let invalidFields = module.validate.rule(field, rule, true) || [];
if (invalidFields.length > 0) {
module.debug('Field is invalid', identifier, rule.type);
fieldErrors.push(module.get.prompt(rule, field));
@@ -1303,7 +1303,7 @@
// takes validation rule and returns whether field passes rule
rule: function (field, rule, internal) {
- var
+ let
$field = module.get.field(field.identifier),
ancillary = module.get.ancillaryValue(rule),
ruleName = module.get.ruleName(rule),
@@ -1311,7 +1311,7 @@
invalidFields = [],
isCheckbox = $field.is(selector.checkbox),
isValid = function (field) {
- var value = isCheckbox ? $(field).filter(':checked').val() : $(field).val();
+ let value = isCheckbox ? $(field).filter(':checked').val() : $(field).val();
// cast to string avoiding encoding special values
value = value === undefined || value === '' || value === null
? ''
@@ -1389,7 +1389,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1410,7 +1410,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1441,7 +1441,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1453,7 +1453,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query;
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
@@ -1629,7 +1629,7 @@
// template that produces error message
error: function (errors) {
- var
+ let
html = '
'
;
$.each(errors, function (index, value) {
@@ -1645,7 +1645,7 @@
if (errors.length === 1) {
return errors[0];
}
- var
+ let
html = ''
;
$.each(errors, function (index, value) {
@@ -1718,7 +1718,7 @@
if (regExp instanceof RegExp) {
return value.match(regExp);
}
- var
+ let
regExpParts = regExp.match($.fn.form.settings.regExp.flags),
flags
;
@@ -1751,7 +1751,7 @@
if (!(regExp instanceof RegExp)) {
regExp = $.fn.form.settings.regExp.integer;
}
- var
+ let
min,
max,
parts
@@ -1880,7 +1880,7 @@
// matches another field
match: function (value, identifier, $module) {
- var
+ let
matchingValue,
matchingElement
;
@@ -1912,7 +1912,7 @@
// different than another field
different: function (value, identifier, $module) {
// use either id or name of field
- var
+ let
matchingValue,
matchingElement
;
@@ -1942,7 +1942,7 @@
},
creditCard: function (cardNumber, cardTypes) {
- var
+ let
cards = {
visa: {
pattern: /^4/,
@@ -2032,7 +2032,7 @@
}
// verify luhn, adapted from
- var
+ let
length = cardNumber.length,
multiple = 0,
producedValue = [
diff --git a/src/definitions/behaviors/state.js b/src/definitions/behaviors/state.js
index 419eab4f55..b223979f01 100644
--- a/src/definitions/behaviors/state.js
+++ b/src/definitions/behaviors/state.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.state = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -35,7 +35,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.state.settings, parameters)
: $.extend({}, $.fn.state.settings),
@@ -107,7 +107,7 @@
add: {
defaults: function () {
- var
+ let
userStates = parameters && $.isPlainObject(parameters.states)
? parameters.states
: {}
@@ -197,7 +197,7 @@
toggle: {
state: function () {
- var
+ let
apiRequest,
requestCancelled
;
@@ -350,7 +350,7 @@
flash: {
text: function (text, duration, callback) {
- var
+ let
previousText = module.get.text();
module.debug('Flashing text message', text, duration);
text = text || settings.text.flash;
@@ -367,7 +367,7 @@
reset: {
// on mouseout sets text to previous value
text: function () {
- var
+ let
activeText = text.active || $module.data(metadata.storedText),
inactiveText = text.inactive || $module.data(metadata.storedText)
;
@@ -385,7 +385,7 @@
update: {
text: function (text) {
- var
+ let
currentText = module.get.text();
if (text && text !== currentText) {
module.debug('Updating text', text);
@@ -458,7 +458,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -479,7 +479,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -507,7 +507,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -519,7 +519,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/behaviors/visibility.js b/src/definitions/behaviors/visibility.js
index 0969cc540f..e5e5f4b69c 100755
--- a/src/definitions/behaviors/visibility.js
+++ b/src/definitions/behaviors/visibility.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.visibility = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -37,7 +37,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.visibility.settings, parameters)
: $.extend({}, $.fn.visibility.settings),
@@ -230,7 +230,7 @@
if (!Array.isArray(images)) {
images = [images];
}
- var
+ let
imagesLength = images.length,
loadedCounter = 0,
cache = [],
@@ -285,7 +285,7 @@
};
},
image: function () {
- var
+ let
src = $module.data(metadata.src)
;
if (src) {
@@ -405,14 +405,14 @@
is: {
onScreen: function () {
- var
+ let
calculations = module.get.elementCalculations()
;
return calculations.onScreen;
},
offScreen: function () {
- var
+ let
calculations = module.get.elementCalculations()
;
@@ -426,7 +426,7 @@
return false;
},
verticallyScrollableContext: function () {
- var
+ let
overflowY = $context[0] !== window
? $context.css('overflow-y')
: false
@@ -435,7 +435,7 @@
return overflowY === 'auto' || overflowY === 'scroll';
},
horizontallyScrollableContext: function () {
- var
+ let
overflowX = $context[0] !== window
? $context.css('overflow-x')
: false
@@ -508,7 +508,7 @@
},
passed: function (amount, newCallback) {
- var
+ let
calculations = module.get.elementCalculations()
;
// assign callback
@@ -528,7 +528,7 @@
},
onScreen: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onOnScreen,
callbackName = 'onScreen'
@@ -548,7 +548,7 @@
},
offScreen: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onOffScreen,
callbackName = 'offScreen'
@@ -568,7 +568,7 @@
},
passing: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onPassing,
callbackName = 'passing'
@@ -588,7 +588,7 @@
},
topVisible: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onTopVisible,
callbackName = 'topVisible'
@@ -608,7 +608,7 @@
},
bottomVisible: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onBottomVisible,
callbackName = 'bottomVisible'
@@ -628,7 +628,7 @@
},
topPassed: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onTopPassed,
callbackName = 'topPassed'
@@ -648,7 +648,7 @@
},
bottomPassed: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onBottomPassed,
callbackName = 'bottomPassed'
@@ -668,7 +668,7 @@
},
passingReverse: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onPassingReverse,
callbackName = 'passingReverse'
@@ -690,7 +690,7 @@
},
topVisibleReverse: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onTopVisibleReverse,
callbackName = 'topVisibleReverse'
@@ -712,7 +712,7 @@
},
bottomVisibleReverse: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onBottomVisibleReverse,
callbackName = 'bottomVisibleReverse'
@@ -734,7 +734,7 @@
},
topPassedReverse: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onTopPassedReverse,
callbackName = 'topPassedReverse'
@@ -756,7 +756,7 @@
},
bottomPassedReverse: function (newCallback) {
- var
+ let
calculations = module.get.elementCalculations(),
callback = newCallback || settings.onBottomPassedReverse,
callbackName = 'bottomPassedReverse'
@@ -778,7 +778,7 @@
},
execute: function (callback, callbackName) {
- var
+ let
calculations = module.get.elementCalculations(),
screen = module.get.screenCalculations()
;
@@ -817,7 +817,7 @@
},
occurred: function (callback) {
if (callback) {
- var
+ let
occurred = module.cache.occurred
;
if (occurred[callback] !== undefined && occurred[callback] === true) {
@@ -850,7 +850,7 @@
module.cache.scroll = scrollPosition;
},
direction: function () {
- var
+ let
scroll = module.get.scroll(),
lastScroll = module.get.lastScroll(),
direction
@@ -867,7 +867,7 @@
return module.cache.direction;
},
elementPosition: function () {
- var
+ let
element = module.cache.element,
screen = module.get.screenSize()
;
@@ -890,7 +890,7 @@
return element;
},
elementCalculations: function () {
- var
+ let
screen = module.get.screenCalculations(),
element = module.get.elementPosition()
;
@@ -930,7 +930,7 @@
return element;
},
screenCalculations: function () {
- var
+ let
scroll = module.get.scroll()
;
module.save.direction();
@@ -953,7 +953,7 @@
get: {
pixelsPassed: function (amount) {
- var
+ let
element = module.get.elementCalculations()
;
if (amount.search('%') > -1) {
@@ -1066,7 +1066,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1087,7 +1087,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1115,7 +1115,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1127,7 +1127,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/globals/site.js b/src/definitions/globals/site.js
index f54fdbadcf..36b13f948c 100644
--- a/src/definitions/globals/site.js
+++ b/src/definitions/globals/site.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.site = function (parameters) {
- var
+ let
time = Date.now(),
performance = [],
@@ -107,7 +107,7 @@
enabled: {
modules: function (modules) {
- var
+ let
enabledModules = []
;
modules = modules || settings.modules;
@@ -123,7 +123,7 @@
disabled: {
modules: function (modules) {
- var
+ let
disabledModules = []
;
modules = modules || settings.modules;
@@ -148,7 +148,7 @@
? modifyExisting
: true;
$.each(modules, function (index, name) {
- var
+ let
namespace = module.moduleExists(name)
? $.fn[name].settings.namespace || false
: true,
@@ -175,7 +175,7 @@
? modifyExisting
: true;
$.each(modules, function (index, name) {
- var
+ let
$existingModules
;
if (module.moduleExists(name)) {
@@ -303,7 +303,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -324,7 +324,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -349,7 +349,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -361,7 +361,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/accordion.js b/src/definitions/modules/accordion.js
index 371e68ac64..63402a753b 100644
--- a/src/definitions/modules/accordion.js
+++ b/src/definitions/modules/accordion.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.accordion = function (parameters) {
- var
+ let
$allModules = $(this),
time = Date.now(),
@@ -33,7 +33,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.accordion.settings, parameters)
: $.extend({}, $.fn.accordion.settings),
@@ -120,7 +120,7 @@
},
toggle: function (query) {
- var
+ let
$activeTitle = query !== undefined
? (typeof query === 'number'
? $title.eq(query)
@@ -145,7 +145,7 @@
},
open: function (query) {
- var
+ let
$activeTitle = query !== undefined
? (typeof query === 'number'
? $title.eq(query)
@@ -215,7 +215,7 @@
},
close: function (query) {
- var
+ let
$activeTitle = query !== undefined
? (typeof query === 'number'
? $title.eq(query)
@@ -277,7 +277,7 @@
},
closeOthers: function (index) {
- var
+ let
$activeTitle = index !== undefined
? $title.eq(index)
: $(this).closest(selector.title),
@@ -343,7 +343,7 @@
display: function () {
module.verbose('Removing inline display from element', this);
- var $element = $(this);
+ let $element = $(this);
$element.css('display', '');
if ($element.attr('style') === '') {
$element
@@ -355,7 +355,7 @@
opacity: function () {
module.verbose('Removing inline opacity from element', this);
- var $element = $(this);
+ let $element = $(this);
$element.css('opacity', '');
if ($element.attr('style') === '') {
$element
@@ -421,7 +421,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -442,7 +442,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -470,7 +470,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -482,7 +482,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query;
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
diff --git a/src/definitions/modules/calendar.js b/src/definitions/modules/calendar.js
index 796a3e8e76..45f110b0c8 100644
--- a/src/definitions/modules/calendar.js
+++ b/src/definitions/modules/calendar.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.calendar = function (parameters) {
- var
+ let
$allModules = $(this),
$document = $(document),
@@ -44,7 +44,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.calendar.settings, parameters)
: $.extend({}, $.fn.calendar.settings),
@@ -142,7 +142,7 @@
} else {
// prepend the popup element to the activator's parent so that it has less chance of messing with
// the styling (eg input action button needs to be the last child to have correct border radius)
- var
+ let
$activatorParent = $activator.parent(),
domPositionFunction = $activatorParent.closest(selector.append).length > 0 ? 'appendTo' : 'prependTo'
;
@@ -153,12 +153,12 @@
if (isInverted) {
$container.addClass(className.inverted);
}
- var onVisible = function () {
+ let onVisible = function () {
module.refreshTooltips();
return settings.onVisible.apply($container, arguments);
};
- var onHidden = function () {
+ let onHidden = function () {
module.blur();
return settings.onHidden.apply($container, arguments);
@@ -173,15 +173,15 @@
return settings.onVisible.apply($container, arguments);
};
}
- var onShow = function () {
+ let onShow = function () {
// reset the focus date onShow
module.set.focusDate(module.get.date());
module.set.mode(module.get.validatedMode(settings.startMode));
return settings.onShow.apply($container, arguments);
};
- var on = module.setting('on');
- var options = $.extend({}, settings.popupOptions, {
+ let on = module.setting('on');
+ let options = $.extend({}, settings.popupOptions, {
popup: $container,
movePopup: !settings.context,
on: on,
@@ -211,7 +211,7 @@
module.check.disabled();
},
date: function () {
- var date;
+ let date;
if (settings.initialDate) {
date = parser.date(settings.initialDate, settings);
} else if ($module.data(metadata.date) !== undefined) {
@@ -226,11 +226,11 @@
trigger: {
change: function () {
- var
+ let
inputElement = $input[0]
;
if (inputElement) {
- var events = document.createEvent('HTMLEvents');
+ let events = document.createEvent('HTMLEvents');
module.verbose('Triggering native change event');
events.initEvent('change', true, false);
inputElement.dispatchEvent(events);
@@ -240,7 +240,7 @@
create: {
calendar: function () {
- var
+ let
i,
r,
c,
@@ -250,7 +250,7 @@
pageGrid
;
- var
+ let
mode = module.get.mode(),
today = new Date(),
date = module.get.date(),
@@ -263,7 +263,7 @@
module.set.focusDate(focusDate, false, false);
}
- var
+ let
isYear = mode === 'year',
isMonth = mode === 'month',
isDay = mode === 'day',
@@ -272,10 +272,10 @@
isTimeOnly = settings.type === 'time'
;
- var multiMonth = Math.max(settings.multiMonth, 1);
- var monthOffset = !isDay ? 0 : module.get.monthOffset();
+ let multiMonth = Math.max(settings.multiMonth, 1);
+ let monthOffset = !isDay ? 0 : module.get.monthOffset();
- var
+ let
minute = display.getMinutes(),
hour = display.getHours(),
day = display.getDate(),
@@ -283,14 +283,14 @@
year = display.getFullYear()
;
- var columns = isDay
+ let columns = isDay
? (settings.showWeekNumbers ? 8 : 7)
: (isHour ? 4 : timeGap.column);
- var rows = isDay || isHour ? 6 : timeGap.row;
- var pages = isDay ? multiMonth : 1;
+ let rows = isDay || isHour ? 6 : timeGap.row;
+ let pages = isDay ? multiMonth : 1;
- var container = $container;
- var tooltipPosition = container.hasClass('left') ? 'right center' : 'left center';
+ let container = $container;
+ let tooltipPosition = container.hasClass('left') ? 'right center' : 'left center';
container.empty();
if (pages > 1) {
pageGrid = $('').addClass(className.grid).appendTo(container);
@@ -298,18 +298,18 @@
for (p = 0; p < pages; p++) {
if (pages > 1) {
- var pageColumn = $('').addClass(className.column).appendTo(pageGrid);
+ let pageColumn = $('').addClass(className.column).appendTo(pageGrid);
container = pageColumn;
}
- var month = startMonth + p;
- var firstMonthDayColumn = (new Date(year, month, 1).getDay() - (settings.firstDayOfWeek % 7) + 7) % 7;
+ let month = startMonth + p;
+ let firstMonthDayColumn = (new Date(year, month, 1).getDay() - (settings.firstDayOfWeek % 7) + 7) % 7;
if (!settings.constantHeight && isDay) {
- var requiredCells = new Date(year, month + 1, 0).getDate() + firstMonthDayColumn;
+ let requiredCells = new Date(year, month + 1, 0).getDate() + firstMonthDayColumn;
rows = Math.ceil(requiredCells / 7);
}
- var
+ let
yearChange = isYear ? 10 : (isMonth ? 1 : 0),
monthChange = isDay ? 1 : 0,
dayChange = isHour || isMinute ? 1 : 0,
@@ -332,31 +332,31 @@
: new Date(year, month, day + 1)))
;
- var tempMode = mode;
+ let tempMode = mode;
if (isDay && settings.showWeekNumbers) {
tempMode += ' andweek';
}
- var table = $('').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column')
+ let table = $('').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column')
.appendTo(container);
if (isInverted) {
table.addClass(className.inverted);
}
- var textColumns = columns;
+ let textColumns = columns;
// no header for time-only mode
if (!isTimeOnly) {
- var thead = $('').appendTo(table);
+ let thead = $('').appendTo(table);
row = $('
').appendTo(thead);
cell = $(' | ').attr('colspan', '' + columns).appendTo(row);
- var headerDate = isYear || isMonth
+ let headerDate = isYear || isMonth
? new Date(year, 0, 1)
: (isDay
? new Date(year, month, 1)
: new Date(year, month, day, hour, minute));
- var headerText = $('').addClass(className.link).appendTo(cell);
+ let headerText = $('').addClass(className.link).appendTo(cell);
headerText.text(module.helper.dateFormat(formatter[mode + 'Header'], headerDate));
- var newMode = isMonth
+ let newMode = isMonth
? (settings.disableYear ? 'day' : 'year')
: (isDay
? (settings.disableMonth ? 'year' : 'month') // eslint-disable-line unicorn/no-nested-ternary
@@ -364,14 +364,14 @@
headerText.data(metadata.mode, newMode);
if (p === 0) {
- var prev = $('').addClass(className.prev).appendTo(cell);
+ let prev = $('').addClass(className.prev).appendTo(cell);
prev.data(metadata.focusDate, prevDate);
prev.toggleClass(className.disabledCell, !module.helper.isDateInRange(prevLast, mode));
$('').addClass(className.prevIcon).appendTo(prev);
}
if (p === pages - 1) {
- var next = $('').addClass(className.next).appendTo(cell);
+ let next = $('').addClass(className.next).appendTo(cell);
next.data(metadata.focusDate, nextDate);
next.toggleClass(className.disabledCell, !module.helper.isDateInRange(nextFirst, mode));
$('').addClass(className.nextIcon).appendTo(next);
@@ -391,7 +391,7 @@
}
}
- var tbody = $('').appendTo(table);
+ let tbody = $('').appendTo(table);
i = isYear
? Math.ceil(year / 10) * 10 - 9
: (isDay ? 1 - firstMonthDayColumn : 0);
@@ -403,7 +403,7 @@
cell.addClass(className.weekCell);
}
for (c = 0; c < textColumns; c++, i++) {
- var cellDate = isYear
+ let cellDate = isYear
? new Date(i, month, 1, hour, minute)
: (isMonth
? new Date(year, i, 1, hour, minute)
@@ -412,7 +412,7 @@
: (isHour
? new Date(year, month, day, i)
: new Date(year, month, day, hour, i * settings.minTimeGap))));
- var cellText = isYear
+ let cellText = isYear
? i
: (isMonth
? settings.text.monthsShort[i]
@@ -422,11 +422,11 @@
cell = $(' | ').addClass(className.cell).appendTo(row);
cell.text(cellText);
cell.data(metadata.date, cellDate);
- var adjacent = isDay && cellDate.getMonth() !== ((month + 12) % 12);
- var disabled = (!settings.selectAdjacentDays && adjacent) || !module.helper.isDateInRange(cellDate, mode) || settings.isDisabled(cellDate, mode) || module.helper.isDisabled(cellDate, mode) || !module.helper.isEnabled(cellDate, mode);
- var eventDate;
+ let adjacent = isDay && cellDate.getMonth() !== ((month + 12) % 12);
+ let disabled = (!settings.selectAdjacentDays && adjacent) || !module.helper.isDateInRange(cellDate, mode) || settings.isDisabled(cellDate, mode) || module.helper.isDisabled(cellDate, mode) || !module.helper.isEnabled(cellDate, mode);
+ let eventDate = null;
if (disabled) {
- var disabledDate = module.helper.findDayAsObject(cellDate, mode, settings.disabledDates);
+ let disabledDate = module.helper.findDayAsObject(cellDate, mode, settings.disabledDates);
if (disabledDate !== null && disabledDate[metadata.message]) {
cell.attr('data-tooltip', disabledDate[metadata.message]);
cell.attr('data-position', disabledDate[metadata.position] || tooltipPosition);
@@ -438,7 +438,7 @@
}
}
if (mode === 'hour') {
- var disabledHour = module.helper.findHourAsObject(cellDate, mode, settings.disabledHours);
+ let disabledHour = module.helper.findHourAsObject(cellDate, mode, settings.disabledHours);
if (disabledHour !== null && disabledHour[metadata.message]) {
cell.attr('data-tooltip', disabledHour[metadata.message]);
cell.attr('data-position', disabledHour[metadata.position] || tooltipPosition);
@@ -466,8 +466,8 @@
}
}
}
- var active = module.helper.dateEqual(cellDate, date, mode);
- var isToday = module.helper.dateEqual(cellDate, today, mode);
+ let active = module.helper.dateEqual(cellDate, date, mode);
+ let isToday = module.helper.dateEqual(cellDate, today, mode);
cell.toggleClass(className.adjacentCell, adjacent && !eventDate);
cell.toggleClass(className.disabledCell, disabled);
cell.toggleClass(className.activeCell, active && !(adjacent && disabled));
@@ -476,7 +476,7 @@
}
// Allow for external modifications of each cell
- var cellOptions = {
+ let cellOptions = {
mode: mode,
adjacent: adjacent,
disabled: disabled,
@@ -494,8 +494,8 @@
}
if (settings.today) {
- var todayRow = $('
').appendTo(tbody);
- var todayButton = $(' | ').attr('colspan', '' + columns).addClass(className.today).appendTo(todayRow);
+ let todayRow = $('
').appendTo(tbody);
+ let todayButton = $(' | ').attr('colspan', '' + columns).addClass(className.today).appendTo(todayRow);
todayButton.text(formatter.today(settings));
todayButton.data(metadata.date, today);
}
@@ -512,24 +512,24 @@
update: {
focus: function (updateRange, container) {
container = container || $container;
- var mode = module.get.mode();
- var date = module.get.date();
- var focusDate = module.get.focusDate();
- var startDate = module.get.startDate();
- var endDate = module.get.endDate();
- var rangeDate = (updateRange ? focusDate : null) || date || (!isTouch ? focusDate : null);
+ let mode = module.get.mode();
+ let date = module.get.date();
+ let focusDate = module.get.focusDate();
+ let startDate = module.get.startDate();
+ let endDate = module.get.endDate();
+ let rangeDate = (updateRange ? focusDate : null) || date || (!isTouch ? focusDate : null);
container.find('td').each(function () {
- var $cell = $(this);
- var cellDate = $cell.data(metadata.date);
+ let $cell = $(this);
+ let cellDate = $cell.data(metadata.date);
if (!cellDate) {
return;
}
- var disabled = $cell.hasClass(className.disabledCell);
- var active = $cell.hasClass(className.activeCell);
- var adjacent = $cell.hasClass(className.adjacentCell);
- var focused = module.helper.dateEqual(cellDate, focusDate, mode);
- var inRange = !rangeDate
+ let disabled = $cell.hasClass(className.disabledCell);
+ let active = $cell.hasClass(className.activeCell);
+ let adjacent = $cell.hasClass(className.adjacentCell);
+ let focused = module.helper.dateEqual(cellDate, focusDate, mode);
+ let inRange = !rangeDate
? false
: (!!startDate && module.helper.isDateInRange(cellDate, mode, startDate, rangeDate))
|| (!!endDate && module.helper.isDateInRange(cellDate, mode, rangeDate, endDate));
@@ -548,13 +548,13 @@
},
refreshTooltips: function () {
- var winWidth = $(window).width();
+ let winWidth = $(window).width();
$container.find('td[data-position]').each(function () {
- var $cell = $(this);
- var tooltipWidth = window.getComputedStyle($cell[0], '::after').width.replace(/[^\d.]/g, '');
- var tooltipPosition = $cell.attr('data-position');
+ let $cell = $(this);
+ let tooltipWidth = window.getComputedStyle($cell[0], '::after').width.replace(/[^\d.]/g, '');
+ let tooltipPosition = $cell.attr('data-position');
// use a fallback width of 250 (calendar width) for IE/Edge (which return "auto")
- var calcPosition = (winWidth - $cell.width() - (parseInt(tooltipWidth, 10) || 250)) > $cell.offset().left ? 'right' : 'left';
+ let calcPosition = (winWidth - $cell.width() - (parseInt(tooltipWidth, 10) || 250)) > $cell.offset().left ? 'right' : 'left';
if (tooltipPosition.indexOf(calcPosition) === -1) {
$cell.attr('data-position', tooltipPosition.replace(/(left|right)/, calcPosition));
}
@@ -592,9 +592,9 @@
event: {
mouseover: function (event) {
- var target = $(event.target);
- var date = target.data(metadata.date);
- var mousedown = event.buttons === 1;
+ let target = $(event.target);
+ let date = target.data(metadata.date);
+ let mousedown = event.buttons === 1;
if (date) {
module.set.focusDate(date, false, true, mousedown);
}
@@ -605,8 +605,8 @@
event.preventDefault();
}
isTouchDown = event.type.indexOf('touch') >= 0;
- var target = $(event.target);
- var date = target.data(metadata.date);
+ let target = $(event.target);
+ let date = target.data(metadata.date);
if (date) {
module.set.focusDate(date, false, true, true);
}
@@ -617,20 +617,20 @@
event.preventDefault();
event.stopPropagation();
isTouchDown = false;
- var target = $(event.target);
+ let target = $(event.target);
if (target.hasClass('disabled')) {
return;
}
- var parent = target.parent();
+ let parent = target.parent();
if (parent.data(metadata.date) || parent.data(metadata.focusDate) || parent.data(metadata.mode)) {
// clicked on a child element, switch to parent (used when clicking directly on prev/next icon element)
target = parent;
}
- var date = target.data(metadata.date);
- var focusDate = target.data(metadata.focusDate);
- var mode = target.data(metadata.mode);
+ let date = target.data(metadata.date);
+ let focusDate = target.data(metadata.focusDate);
+ let mode = target.data(metadata.mode);
if (date && settings.onSelect.call(element, date, module.get.mode()) !== false) {
- var forceSet = target.hasClass(className.today);
+ let forceSet = target.hasClass(className.today);
module.selectDate(date, forceSet);
} else if (focusDate) {
module.set.focusDate(focusDate);
@@ -639,38 +639,38 @@
}
},
keydown: function (event) {
- var keyCode = event.which;
+ let keyCode = event.which;
if (keyCode === 9) {
// tab
module.popup('hide');
}
if (module.popup('is visible')) {
- var mode = module.get.mode();
+ let mode = module.get.mode();
switch (keyCode) {
// arrow keys
case 37:
case 38:
case 39:
case 40: {
- var bigIncrement = mode === 'day'
+ let bigIncrement = mode === 'day'
? 7
: (mode === 'hour'
? 4
: (mode === 'minute' ? timeGap.column : 3)); // eslint-disable-line unicorn/no-nested-ternary
- var increment = keyCode === 37
+ let increment = keyCode === 37
? -1
: (keyCode === 38
? -bigIncrement
: (keyCode === 39 ? 1 : bigIncrement)); // eslint-disable-line unicorn/no-nested-ternary
increment *= mode === 'minute' ? settings.minTimeGap : 1;
- var focusDate = module.get.focusDate() || module.get.date() || new Date();
- var year = focusDate.getFullYear() + (mode === 'year' ? increment : 0);
- var month = focusDate.getMonth() + (mode === 'month' ? increment : 0);
- var day = focusDate.getDate() + (mode === 'day' ? increment : 0);
- var hour = focusDate.getHours() + (mode === 'hour' ? increment : 0);
- var minute = focusDate.getMinutes() + (mode === 'minute' ? increment : 0);
- var newFocusDate = new Date(year, month, day, hour, minute);
+ let focusDate = module.get.focusDate() || module.get.date() || new Date();
+ let year = focusDate.getFullYear() + (mode === 'year' ? increment : 0);
+ let month = focusDate.getMonth() + (mode === 'month' ? increment : 0);
+ let day = focusDate.getDate() + (mode === 'day' ? increment : 0);
+ let hour = focusDate.getHours() + (mode === 'hour' ? increment : 0);
+ let minute = focusDate.getMinutes() + (mode === 'minute' ? increment : 0);
+ let newFocusDate = new Date(year, month, day, hour, minute);
if (settings.type === 'time') {
newFocusDate = module.helper.mergeDateTime(focusDate, newFocusDate);
}
@@ -682,7 +682,7 @@
}
// enter key
case 13: {
- var date = module.get.focusDate();
+ let date = module.get.focusDate();
if (date && !settings.isDisabled(date, mode) && !module.helper.isDisabled(date, mode) && module.helper.isEnabled(date, mode)) {
if (settings.onSelect.call(element, date, module.get.mode()) !== false) {
module.selectDate(date);
@@ -711,8 +711,8 @@
}
},
inputChange: function () {
- var val = $input.val();
- var date = parser.date(val, settings);
+ let val = $input.val();
+ let date = parser.date(val, settings);
module.set.date(date, false);
},
inputFocus: function () {
@@ -721,8 +721,8 @@
inputBlur: function () {
$container.removeClass(className.active);
if (settings.formatInput) {
- var date = module.get.date();
- var text = module.helper.dateFormat(formatter[settings.type], date);
+ let date = module.get.date();
+ let text = module.helper.dateFormat(formatter[settings.type], date);
$input.val(text);
}
if (selectionComplete) {
@@ -782,7 +782,7 @@
get: {
weekOfYear: function (weekYear, weekMonth, weekDay) {
// adapted from http://www.merlyn.demon.co.uk/weekcalc.htm
- var ms1d = 24 * 3600 * 1000,
+ let ms1d = 24 * 3600 * 1000,
ms7d = 7 * ms1d,
DC3 = Date.UTC(weekYear, weekMonth, weekDay + 3) / ms1d, // an absolute day number
AWN = Math.floor(DC3 / 7), // an absolute week number
@@ -804,12 +804,12 @@
return $module.data(metadata.focusDate) || null;
},
startDate: function () {
- var startModule = module.get.calendarModule(settings.startCalendar);
+ let startModule = module.get.calendarModule(settings.startCalendar);
return (startModule ? startModule.get.date() : $module.data(metadata.startDate)) || null;
},
endDate: function () {
- var endModule = module.get.calendarModule(settings.endCalendar);
+ let endModule = module.get.calendarModule(settings.endCalendar);
return (endModule ? endModule.get.date() : $module.data(metadata.endDate)) || null;
},
@@ -824,12 +824,12 @@
},
mode: function () {
// only returns valid modes for the current settings
- var mode = $module.data(metadata.mode) || settings.startMode;
+ let mode = $module.data(metadata.mode) || settings.startMode;
return module.get.validatedMode(mode);
},
validatedMode: function (mode) {
- var validModes = module.get.validModes();
+ let validModes = module.get.validModes();
if ($.inArray(mode, validModes) >= 0) {
return mode;
}
@@ -844,7 +844,7 @@
return $module.data(metadata.type) || settings.type;
},
validModes: function () {
- var validModes = [];
+ let validModes = [];
if (settings.type !== 'time') {
if (!settings.disableYear || settings.type === 'year') {
validModes.push('year');
@@ -894,8 +894,8 @@
date = module.helper.sanitiseDate(date);
date = module.helper.dateInRange(date);
- var mode = module.get.mode();
- var text = module.helper.dateFormat(formatter[settings.type], date);
+ let mode = module.get.mode();
+ let text = module.helper.dateFormat(formatter[settings.type], date);
if (fireChange && settings.onBeforeChange.call(element, date, text, mode) === false) {
return false;
@@ -907,7 +907,7 @@
return false;
}
- var endDate = module.get.endDate();
+ let endDate = module.get.endDate();
if (!!endDate && !!date && date > endDate) {
// selected date is greater than end date in range, so clear end date
module.set.endDate();
@@ -924,7 +924,7 @@
},
startDate: function (date, refreshCalendar) {
date = module.helper.sanitiseDate(date);
- var startModule = module.get.calendarModule(settings.startCalendar);
+ let startModule = module.get.calendarModule(settings.startCalendar);
if (startModule) {
startModule.set.date(date);
}
@@ -932,7 +932,7 @@
},
endDate: function (date, refreshCalendar) {
date = module.helper.sanitiseDate(date);
- var endModule = module.get.calendarModule(settings.endCalendar);
+ let endModule = module.get.calendarModule(settings.endCalendar);
if (endModule) {
endModule.set.date(date);
}
@@ -941,17 +941,17 @@
focusDate: function (date, refreshCalendar, updateFocus, updateRange) {
date = module.helper.sanitiseDate(date);
date = module.helper.dateInRange(date);
- var isDay = module.get.mode() === 'day';
- var oldFocusDate = module.get.focusDate();
+ let isDay = module.get.mode() === 'day';
+ let oldFocusDate = module.get.focusDate();
if (isDay && date && oldFocusDate) {
- var yearDelta = date.getFullYear() - oldFocusDate.getFullYear();
- var monthDelta = yearDelta * 12 + date.getMonth() - oldFocusDate.getMonth();
+ let yearDelta = date.getFullYear() - oldFocusDate.getFullYear();
+ let monthDelta = yearDelta * 12 + date.getMonth() - oldFocusDate.getMonth();
if (monthDelta) {
- var monthOffset = module.get.monthOffset() - monthDelta;
+ let monthOffset = module.get.monthOffset() - monthDelta;
module.set.monthOffset(monthOffset, false);
}
}
- var changed = module.set.dataKeyValue(metadata.focusDate, date, !!date && refreshCalendar);
+ let changed = module.set.dataKeyValue(metadata.focusDate, date, !!date && refreshCalendar);
updateFocus = (updateFocus !== false && changed && refreshCalendar === false) || focusDateUsedForRange != updateRange;
focusDateUsedForRange = updateRange;
if (updateFocus) {
@@ -977,7 +977,7 @@
}
},
monthOffset: function (monthOffset, refreshCalendar) {
- var multiMonth = Math.max(settings.multiMonth, 1);
+ let multiMonth = Math.max(settings.multiMonth, 1);
monthOffset = Math.max(1 - multiMonth, Math.min(0, monthOffset));
module.set.dataKeyValue(metadata.monthOffset, monthOffset, refreshCalendar);
},
@@ -985,8 +985,8 @@
module.set.dataKeyValue(metadata.mode, mode, refreshCalendar);
},
dataKeyValue: function (key, value, refreshCalendar) {
- var oldValue = $module.data(key);
- var equal = oldValue === value || (oldValue <= value && oldValue >= value); // equality test for dates and string objects
+ let oldValue = $module.data(key);
+ let equal = oldValue === value || (oldValue <= value && oldValue >= value); // equality test for dates and string objects
if (value) {
$module.data(key, value);
} else {
@@ -1003,20 +1003,20 @@
selectDate: function (date, forceSet) {
module.verbose('New date selection', date);
- var mode = module.get.mode();
- var complete = forceSet || mode === 'minute'
+ let mode = module.get.mode();
+ let complete = forceSet || mode === 'minute'
|| (settings.disableMinute && mode === 'hour')
|| (settings.type === 'date' && mode === 'day')
|| (settings.type === 'month' && mode === 'month')
|| (settings.type === 'year' && mode === 'year');
if (complete) {
- var canceled = module.set.date(date) === false;
+ let canceled = module.set.date(date) === false;
if (!canceled) {
selectionComplete = true;
if (settings.closable) {
module.popup('hide');
// if this is a range calendar, focus the container or input. This will open the popup from its event listeners.
- var endModule = module.get.calendarModule(settings.endCalendar);
+ let endModule = module.get.calendarModule(settings.endCalendar);
if (endModule) {
endModule.refresh();
if (endModule.setting('on') !== 'focus') {
@@ -1027,7 +1027,7 @@
}
}
} else {
- var newMode = mode === 'year'
+ let newMode = mode === 'year'
? (!settings.disableMonth ? 'month' : 'day')
: (mode === 'month'
? 'day'
@@ -1078,7 +1078,7 @@
return format.call(module, date, settings);
}
- var
+ let
D = date.getDate(),
M = date.getMonth(),
Y = date.getFullYear(),
@@ -1129,7 +1129,7 @@
},
isDisabled: function (date, mode) {
return (mode === 'day' || mode === 'month' || mode === 'year' || mode === 'hour') && (((mode === 'day' && settings.disabledDaysOfWeek.indexOf(date.getDay()) !== -1) || settings.disabledDates.some(function (d) {
- var blocked = false;
+ let blocked = false;
if (typeof d === 'string') {
d = module.helper.sanitiseDate(d);
@@ -1149,7 +1149,7 @@
} else if (Array.isArray(d[metadata.month])) {
blocked = d[metadata.month].indexOf(date.getMonth()) > -1;
} else if (d[metadata.month] instanceof Date) {
- var sdate = module.helper.sanitiseDate(d[metadata.month]);
+ let sdate = module.helper.sanitiseDate(d[metadata.month]);
blocked = (date.getMonth() === sdate.getMonth()) && (date.getFullYear() === sdate.getFullYear());
}
@@ -1166,7 +1166,7 @@
return blocked;
})) || (mode === 'hour' && settings.disabledHours.some(function (d) {
- var blocked = false;
+ let blocked = false;
if (typeof d === 'string') {
d = module.helper.sanitiseDate(d);
@@ -1209,7 +1209,7 @@
isEnabled: function (date, mode) {
if (mode === 'day') {
return settings.enabledDates.length === 0 || settings.enabledDates.some(function (d) {
- var enabled = false;
+ let enabled = false;
if (typeof d === 'string') {
d = module.helper.sanitiseDate(d);
@@ -1228,14 +1228,14 @@
},
findDayAsObject: function (date, mode, dates) {
if (mode === 'day' || mode === 'month' || mode === 'year') {
- var d;
- for (var i = 0; i < dates.length; i++) {
+ let d;
+ for (let i = 0; i < dates.length; i++) {
d = dates[i];
if (typeof d === 'string') {
d = module.helper.sanitiseDate(d);
}
if (d instanceof Date && module.helper.dateEqual(date, d, mode)) {
- var dateObject = {};
+ let dateObject = {};
dateObject[metadata.date] = d;
return dateObject;
@@ -1259,7 +1259,7 @@
return d;
}
} else if (d[metadata.month] instanceof Date) {
- var sdate = module.helper.sanitiseDate(d[metadata.month]);
+ let sdate = module.helper.sanitiseDate(d[metadata.month]);
if ((date.getMonth() === sdate.getMonth()) && (date.getFullYear() === sdate.getFullYear())) {
return d;
}
@@ -1284,8 +1284,8 @@
},
findHourAsObject: function (date, mode, hours) {
if (mode === 'hour') {
- var d;
- var hourCheck = function (date, d) {
+ let d;
+ let hourCheck = function (date, d) {
if (d[metadata.hours]) {
if (typeof d[metadata.hours] === 'number' && date.getHours() === d[metadata.hours]) {
return d;
@@ -1297,7 +1297,7 @@
}
}
};
- for (var i = 0; i < hours.length; i++) {
+ for (let i = 0; i < hours.length; i++) {
d = hours[i];
if (typeof d === 'number' && date.getHours() === d) {
return null;
@@ -1347,11 +1347,11 @@
mode = 'day';
}
- var isTimeOnly = settings.type === 'time';
- var isYear = mode === 'year';
- var isYearOrMonth = isYear || mode === 'month';
- var isMinute = mode === 'minute';
- var isHourOrMinute = isMinute || mode === 'hour';
+ let isTimeOnly = settings.type === 'time';
+ let isYear = mode === 'year';
+ let isYearOrMonth = isYear || mode === 'month';
+ let isMinute = mode === 'minute';
+ let isHourOrMinute = isMinute || mode === 'hour';
// only care about a minute accuracy of settings.minTimeGap
date1 = new Date(
isTimeOnly ? 2000 : date1.getFullYear(),
@@ -1375,7 +1375,7 @@
},
isDateInRange: function (date, mode, minDate, maxDate) {
if (!minDate && !maxDate) {
- var startDate = module.get.startDate();
+ let startDate = module.get.startDate();
minDate = startDate && settings.minDate ? new Date(Math.max(startDate, settings.minDate)) : startDate || settings.minDate;
maxDate = settings.maxDate;
}
@@ -1387,12 +1387,12 @@
},
dateInRange: function (date, minDate, maxDate) {
if (!minDate && !maxDate) {
- var startDate = module.get.startDate();
+ let startDate = module.get.startDate();
minDate = startDate && settings.minDate ? new Date(Math.max(startDate, settings.minDate)) : startDate || settings.minDate;
maxDate = settings.maxDate;
}
minDate = minDate && new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate(), minDate.getHours(), settings.minTimeGap * Math.ceil(minDate.getMinutes() / settings.minTimeGap));
- var isTimeOnly = settings.type === 'time';
+ let isTimeOnly = settings.type === 'time';
return !date
? date
@@ -1463,7 +1463,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1484,7 +1484,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1512,7 +1512,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1524,7 +1524,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -1649,7 +1649,7 @@
formatter: {
yearHeader: function (date, settings) {
- var decadeYear = Math.ceil(date.getFullYear() / 10) * 10;
+ let decadeYear = Math.ceil(date.getFullYear() / 10) * 10;
return (decadeYear - 9) + ' - ' + (decadeYear + 2);
},
@@ -1690,41 +1690,41 @@
}
// Reverse date and month in some cases
text = settings.monthFirst || !/^\d{1,2}[./-]/.test(text) ? text : text.replace(/[./-]/g, '/').replace(/(\d+)\/(\d+)/, '$2/$1');
- var textDate = new Date(text);
- var numberOnly = text.match(/^\d+$/) !== null;
+ let textDate = new Date(text);
+ let numberOnly = text.match(/^\d+$/) !== null;
if (!numberOnly && !isNaN(textDate.getDate())) {
return textDate;
}
text = text.toLowerCase();
- var
+ let
i,
j,
k
;
- var
+ let
minute = -1,
hour = -1,
day = -1,
month = -1,
year = -1
;
- var isAm;
+ let isAm;
- var isTimeOnly = settings.type === 'time';
- var isDateOnly = settings.type.indexOf('time') < 0;
+ let isTimeOnly = settings.type === 'time';
+ let isDateOnly = settings.type.indexOf('time') < 0;
- var
+ let
words = text.split(settings.regExp.dateWords),
word
;
- var
+ let
numbers = text.split(settings.regExp.dateNumbers),
number
;
- var parts;
- var monthString;
+ let parts;
+ let monthString;
if (!isDateOnly) {
// am/pm
@@ -1908,7 +1908,7 @@
}
}
- var date = new Date(year, month - 1, day, hour, minute);
+ let date = new Date(year, month - 1, day, hour, minute);
if (date.getMonth() !== month - 1 || date.getFullYear() !== year) {
// month or year don't match up, switch to last day of the month
date = new Date(year, month, 0, hour, minute);
diff --git a/src/definitions/modules/checkbox.js b/src/definitions/modules/checkbox.js
index bf985c1d33..0c142fe0e6 100644
--- a/src/definitions/modules/checkbox.js
+++ b/src/definitions/modules/checkbox.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.checkbox = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -34,7 +34,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
className = settings.className,
@@ -149,7 +149,7 @@
},
attachEvents: function (selector, event) {
- var
+ let
$element = $(selector)
;
event = isFunction(module[event])
@@ -179,7 +179,7 @@
}
},
click: function (event) {
- var
+ let
$target = $(event.target)
;
if ($target.is(selector.input)) {
@@ -197,7 +197,7 @@
event.preventDefault();
},
keydown: function (event) {
- var
+ let
key = event.which,
keyCode = {
enter: 13,
@@ -210,7 +210,7 @@
}
;
- var
+ let
r = module.get.radios(),
rIndex = r.index($module),
rLen = r.length,
@@ -351,7 +351,7 @@
get: {
radios: function () {
- var
+ let
name = module.get.name()
;
@@ -580,11 +580,11 @@
trigger: {
change: function () {
- var
+ let
inputElement = $input[0]
;
if (inputElement) {
- var events = document.createEvent('HTMLEvents');
+ let events = document.createEvent('HTMLEvents');
module.verbose('Triggering native change event');
events.initEvent('change', true, false);
inputElement.dispatchEvent(events);
@@ -632,7 +632,7 @@
},
uncheckOthers: function () {
- var
+ let
$radios = module.get.otherRadios()
;
module.debug('Unchecking other radios', $radios);
@@ -706,7 +706,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -727,7 +727,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -755,7 +755,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -767,7 +767,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/dimmer.js b/src/definitions/modules/dimmer.js
index 596f9c8deb..f6fea02a61 100755
--- a/src/definitions/modules/dimmer.js
+++ b/src/definitions/modules/dimmer.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.dimmer = function (parameters) {
- var
+ let
$allModules = $(this),
time = Date.now(),
@@ -34,7 +34,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.dimmer.settings, parameters)
: $.extend({}, $.fn.dimmer.settings),
@@ -152,7 +152,7 @@
},
addContent: function (element) {
- var
+ let
$content = $(element)
;
module.debug('Add content to dimmer', $content);
@@ -162,7 +162,7 @@
},
create: function () {
- var
+ let
$element = $(settings.template.dimmer(settings))
;
if (settings.dimmerName) {
@@ -395,7 +395,7 @@
set: {
opacity: function (opacity) {
- var
+ let
color = $dimmer.css('background-color'),
colorArray = color.split(','),
isRGB = colorArray && colorArray.length >= 3
@@ -511,7 +511,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -532,7 +532,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -563,7 +563,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -575,7 +575,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -710,7 +710,7 @@
template: {
dimmer: function (settings) {
- var
+ let
d = $('').addClass('ui dimmer'),
l
;
diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js
index 81c82df177..a57bb42a2a 100644
--- a/src/definitions/modules/dropdown.js
+++ b/src/definitions/modules/dropdown.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.dropdown = function (parameters) {
- var
+ let
$allModules = $(this),
$document = $(document),
@@ -36,7 +36,7 @@
;
$allModules.each(function (elementIndex) {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.dropdown.settings, parameters)
: $.extend({}, $.fn.dropdown.settings),
@@ -220,7 +220,7 @@
module.verbose('Creating unique id for element', id);
},
userChoice: function (values) {
- var
+ let
$userChoices,
$userChoice,
html
@@ -255,7 +255,7 @@
return $userChoices;
},
userLabels: function (value) {
- var
+ let
userValues = module.get.userValues()
;
if (userValues) {
@@ -307,7 +307,7 @@
},
nextAvailable: function ($selected) {
$selected = $selected.eq(0);
- var
+ let
$nextAvailable = $selected.nextAll(selector.item).not(selector.unselectable).eq(0),
$prevAvailable = $selected.prevAll(selector.item).not(selector.unselectable).eq(0),
hasNext = $nextAvailable.length > 0
@@ -324,7 +324,7 @@
setup: {
api: function () {
- var
+ let
apiSettings = {
debug: settings.debug,
urlData: {
@@ -356,7 +356,7 @@
}
if (module.is.search() && !module.has.search()) {
module.verbose('Adding search input');
- var
+ let
labelNode = $module.prev('label')
;
$search = $('')
@@ -379,7 +379,7 @@
}
},
select: function () {
- var
+ let
selectValues = module.get.selectValues()
;
module.debug('Dropdown initialized on a select', selectValues);
@@ -445,7 +445,7 @@
module.setup.returnedObject();
},
returnedObject: function () {
- var
+ let
$firstModules = $allModules.slice(0, elementIndex),
$lastModules = $allModules.slice(elementIndex + 1)
;
@@ -563,7 +563,7 @@
});
// Hide submenus explicitly. On some browsers (esp. mobile), they will not automatically receive a
// mouseleave event
- var $subMenu = $module.find(selector.menu);
+ let $subMenu = $module.find(selector.menu);
if ($subMenu.length > 0) {
module.verbose('Hiding sub-menu', $subMenu);
$subMenu.each(function () {
@@ -595,7 +595,7 @@
},
hideSubMenus: function () {
- var
+ let
$subMenus = $menu.children(selector.item).find(selector.menu)
;
module.verbose('Hiding sub menus', $subMenus);
@@ -721,7 +721,7 @@
},
filter: function (query) {
- var
+ let
searchTerm = query !== undefined
? query
: module.get.query(),
@@ -770,7 +770,7 @@
if (settings.filterRemoteData) {
module.filterItems(searchTerm);
}
- var preSelected = $input.val();
+ let preSelected = $input.val();
if (!Array.isArray(preSelected)) {
preSelected = preSelected && preSelected !== '' ? preSelected.split(settings.delimiter) : [];
}
@@ -797,7 +797,7 @@
if (!Array.isArray(callbackParameters)) {
callbackParameters = [callbackParameters];
}
- var
+ let
apiSettings = {
errorDuration: false,
cache: 'local',
@@ -826,21 +826,21 @@
}
},
onSuccess: function (response, $module, xhr) {
- var
+ let
values = response[fields.remoteValues]
;
if (!Array.isArray(values)) {
values = [];
}
module.remove.message();
- var menuConfig = {};
+ let menuConfig = {};
menuConfig[fields.values] = values;
module.setup.menu(menuConfig);
if (values.length === 0 && !settings.allowAdditions) {
module.add.message(message.noResults);
} else {
- var value = module.is.multiple() ? module.get.values() : module.get.value();
+ let value = module.is.multiple() ? module.get.values() : module.get.value();
if (value !== '') {
module.verbose('Value(s) present after click icon, select value(s) in items');
module.set.selected(value, null, true, true);
@@ -866,7 +866,7 @@
},
filterItems: function (query) {
- var
+ let
searchTerm = module.remove.diacritics(
query !== undefined
? query
@@ -884,7 +884,7 @@
module.verbose('Searching for matching values', searchTerm);
$item
.each(function () {
- var
+ let
$choice = $(this),
text,
value
@@ -942,7 +942,7 @@
.filter(function () {
// First find the last divider in this divider group
// Dividers which are direct siblings are considered a group
- var $lastDivider = $(this).nextUntil(selector.item);
+ let $lastDivider = $(this).nextUntil(selector.item);
return ($lastDivider.length > 0 ? $lastDivider : $(this))
// Count all non-filtered items until the next divider (or end of the dropdown)
@@ -957,7 +957,7 @@
},
fuzzySearch: function (query, term) {
- var
+ let
termLength = term.length,
queryLength = query.length
;
@@ -969,8 +969,8 @@
if (queryLength === termLength) {
return query === term;
}
- for (var characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {
- var
+ for (let characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {
+ let
continueSearch = false,
queryCharacter = query.charCodeAt(characterIndex)
;
@@ -1022,7 +1022,7 @@
},
forceSelection: function () {
- var
+ let
$currentlySelected = $item.not(className.filtered).filter('.' + className.selected).eq(0),
$activeItem = $item.not(className.filtered).filter('.' + className.active).eq(0),
$selectedItem = $currentlySelected.length > 0
@@ -1044,7 +1044,7 @@
module.clear();
}
module.debug('Creating dropdown with specified values', values);
- var menuConfig = {};
+ let menuConfig = {};
menuConfig[fields.values] = values;
module.setup.menu(menuConfig);
$.each(values, function (index, item) {
@@ -1062,7 +1062,7 @@
$input.html('');
$input.append('');
$.each(values, function (index, item) {
- var
+ let
value = settings.templates.deQuote(item[fields.value]),
name = settings.templates.escape(
item[fields.name] || '',
@@ -1078,7 +1078,7 @@
event: {
paste: function (event) {
- var
+ let
pasteValue = (event.originalEvent.clipboardData || window.clipboardData).getData('text'),
tokens = pasteValue.split(settings.delimiter)
;
@@ -1124,7 +1124,7 @@
}
},
click: function (event) {
- var
+ let
$target = $(event.target)
;
// focus search
@@ -1206,7 +1206,7 @@
},
label: {
click: function (event) {
- var
+ let
$label = $(this),
$labels = $module.find(selector.label),
$activeLabels = $labels.filter('.' + className.active),
@@ -1231,7 +1231,7 @@
},
remove: {
click: function (event) {
- var
+ let
$label = $(this).parent()
;
if ($label.hasClass(className.active)) {
@@ -1246,7 +1246,7 @@
},
test: {
toggle: function (event) {
- var
+ let
toggleBehavior = module.is.multiple()
? module.show
: module.toggle
@@ -1294,7 +1294,7 @@
},
menu: {
mutation: function (mutations) {
- var
+ let
mutation = mutations[0],
$addedNode = mutation.addedNodes
? $(mutation.addedNodes[0])
@@ -1323,7 +1323,7 @@
},
item: {
mouseenter: function (event) {
- var
+ let
$target = $(event.target),
$item = $(this),
$subMenu = $item.children(selector.menu),
@@ -1344,7 +1344,7 @@
}
},
mouseleave: function (event) {
- var
+ let
$subMenu = $(this).find(selector.menu)
;
if ($subMenu.length > 0) {
@@ -1358,7 +1358,7 @@
}
},
click: function (event, skipRefocus) {
- var
+ let
$choice = $(this),
$target = event
? $(event.target)
@@ -1399,12 +1399,12 @@
document: {
// label selection should occur even when element has no focus
keydown: function (event) {
- var
+ let
pressedKey = event.which,
isShortcutKey = module.is.inObject(pressedKey, keys)
;
if (isShortcutKey) {
- var
+ let
$label = $module.find(selector.label),
$activeLabel = $label.filter('.' + className.active),
activeValue = $activeLabel.data(metadata.value),
@@ -1518,12 +1518,12 @@
},
keydown: function (event) {
- var
+ let
pressedKey = event.which,
isShortcutKey = module.is.inObject(pressedKey, keys) || event.key === settings.delimiter
;
if (isShortcutKey) {
- var
+ let
$currentlySelected = $item.not(selector.unselectable).filter('.' + className.selected).eq(0),
$activeItem = $menu.children('.' + className.active).eq(0),
$selectedItem = $currentlySelected.length > 0
@@ -1705,11 +1705,11 @@
trigger: {
change: function () {
- var
+ let
inputElement = $input[0]
;
if (inputElement) {
- var events = document.createEvent('HTMLEvents');
+ let events = document.createEvent('HTMLEvents');
module.verbose('Triggering native change event');
events.initEvent('change', true, false);
inputElement.dispatchEvent(events);
@@ -1733,7 +1733,7 @@
selectActionActive = false;
},
eventInModule: function (event, callback) {
- var
+ let
$target = $(event.target),
inDocument = $target.closest(document.documentElement).length > 0,
inModule = $target.closest($module).length > 0
@@ -1753,7 +1753,7 @@
return false;
},
eventOnElement: function (event, callback) {
- var
+ let
$target = $(event.target),
$label = $target.closest(selector.siblingLabel),
inVisibleDOM = document.body.contains(event.target),
@@ -1852,7 +1852,7 @@
return Math.ceil($sizer.width() + (module.is.edge() ? 3 : 1));
},
selectionCount: function () {
- var
+ let
values = module.get.values(),
count
;
@@ -1868,7 +1868,7 @@
: settings.transition;
},
userValues: function () {
- var
+ let
values = module.get.values(true)
;
if (!values) {
@@ -1888,7 +1888,7 @@
});
},
caretPosition: function (returnEndPos) {
- var
+ let
input = $search[0],
range,
rangeLength
@@ -1912,7 +1912,7 @@
}
},
value: function () {
- var
+ let
value = $input.length > 0
? $input.val()
: $module.data(metadata.value),
@@ -1925,7 +1925,7 @@
: value;
},
values: function (raw) {
- var
+ let
value = module.get.value()
;
if (value === '') {
@@ -1941,7 +1941,7 @@
: value;
},
remoteValues: function () {
- var
+ let
values = module.get.values(),
remoteValues = false
;
@@ -1950,7 +1950,7 @@
values = [values];
}
$.each(values, function (index, value) {
- var
+ let
name = module.read.remoteData(value)
;
module.verbose('Restoring value from session data', name, value);
@@ -2001,7 +2001,7 @@
: String(choiceText));
},
inputEvent: function () {
- var
+ let
input = $search[0]
;
if (input) {
@@ -2015,7 +2015,7 @@
return false;
},
selectValues: function () {
- var
+ let
select = {},
oldGroup = [],
values = []
@@ -2023,7 +2023,7 @@
$module
.find('option')
.each(function () {
- var
+ let
$option = $(this),
name = $option.html(),
disabled = $option.attr('disabled'),
@@ -2084,7 +2084,7 @@
return $item.filter('.' + className.active);
},
selectedItem: function () {
- var
+ let
$selectedItem = $item.not(selector.unselectable).filter('.' + className.selected)
;
@@ -2093,7 +2093,7 @@
: $item.eq(0);
},
itemWithAdditions: function (value) {
- var
+ let
$items = module.get.item(value),
$userItems = module.create.userChoice(value),
hasUserItems = $userItems && $userItems.length > 0
@@ -2107,7 +2107,7 @@
return $items;
},
item: function (value, strict) {
- var
+ let
$selectedItem = false,
shouldSearch,
isMultiple
@@ -2127,7 +2127,7 @@
if (shouldSearch) {
$item
.each(function () {
- var
+ let
$choice = $(this),
optionText = module.get.choiceText($choice),
optionValue = module.get.choiceValue($choice, optionText)
@@ -2212,7 +2212,7 @@
module.restore.defaultValue();
},
defaultText: function () {
- var
+ let
defaultText = module.get.defaultText(),
placeholderText = module.get.placeholderText
;
@@ -2228,7 +2228,7 @@
module.set.placeholderText();
},
defaultValue: function () {
- var
+ let
defaultValue = module.get.defaultValue()
;
if (defaultValue !== undefined) {
@@ -2270,7 +2270,7 @@
} else {
module.set.selected();
}
- var value = module.get.value();
+ let value = module.get.value();
if (value && value !== '' && !(Array.isArray(value) && value.length === 0)) {
$input.removeClass(className.noselection);
} else {
@@ -2279,7 +2279,7 @@
module.remove.initialLoad();
},
remoteValues: function () {
- var
+ let
values = module.get.remoteValues()
;
module.debug('Recreating selected from session data', values);
@@ -2299,7 +2299,7 @@
read: {
remoteData: function (value) {
- var
+ let
name
;
if (window.Storage === undefined) {
@@ -2322,21 +2322,21 @@
module.save.defaultValue();
},
defaultValue: function () {
- var
+ let
value = module.get.value()
;
module.verbose('Saving default value as', value);
$module.data(metadata.defaultValue, value);
},
defaultText: function () {
- var
+ let
text = module.get.text()
;
module.verbose('Saving default text as', text);
$module.data(metadata.defaultText, text);
},
placeholderText: function () {
- var
+ let
text
;
if (settings.placeholder !== false && $text.hasClass(className.placeholder)) {
@@ -2373,7 +2373,7 @@
},
scrollPage: function (direction, $selectedItem) {
- var
+ let
$currentItem = $selectedItem || module.get.selectedItem(),
$menu = $currentItem.closest(selector.menu),
menuHeight = $menu.outerHeight(),
@@ -2418,7 +2418,7 @@
set: {
filtered: function () {
- var
+ let
isMultiple = module.is.multiple(),
isSearch = module.is.searchSelection(),
isSearchMultiple = isMultiple && isSearch,
@@ -2488,13 +2488,13 @@
}
},
partialSearch: function (text) {
- var
+ let
length = module.get.query().length
;
$search.val(text.slice(0, length));
},
scrollPosition: function ($item, forceScroll) {
- var
+ let
edgeTolerance = 5,
$menu,
hasActive,
@@ -2560,7 +2560,7 @@
}
},
selectedItem: function ($item) {
- var
+ let
value = module.get.choiceValue($item),
searchText = module.get.choiceText($item, false),
text = module.get.choiceText($item)
@@ -2573,7 +2573,7 @@
module.set.text(text);
},
selectedLetter: function (letter) {
- var
+ let
$selectedItem = $item.filter('.' + className.selected),
alreadySelectedLetter = $selectedItem.length > 0 && module.has.firstLetter($selectedItem, letter),
$nextValue = false,
@@ -2632,11 +2632,11 @@
}
},
upward: function ($currentMenu) {
- var $element = $currentMenu || $module;
+ let $element = $currentMenu || $module;
$element.addClass(className.upward);
},
leftward: function ($currentMenu) {
- var $element = $currentMenu || $menu;
+ let $element = $currentMenu || $menu;
$element.addClass(className.leftward);
},
value: function (value, text, $selected, preventChangeTrigger) {
@@ -2650,7 +2650,7 @@
} else {
$input.addClass(className.noselection);
}
- var
+ let
escapedValue = module.escape.value(value),
hasInput = $input.length > 0,
currentValue = module.get.values(),
@@ -2719,7 +2719,7 @@
preventChangeTrigger = $selectedItem;
$selectedItem = undefined;
}
- var
+ let
isMultiple = module.is.multiple()
;
$selectedItem = settings.allowAdditions
@@ -2741,7 +2741,7 @@
// select each item
$selectedItem
.each(function () {
- var
+ let
$selected = $(this),
selectedText = module.get.choiceText($selected),
selectedValue = module.get.choiceValue($selected, selectedText),
@@ -2804,7 +2804,7 @@
add: {
label: function (value, text, shouldAnimate) {
- var
+ let
$next = module.is.searchSelection()
? $search
: $text,
@@ -2850,7 +2850,7 @@
}
},
message: function (message) {
- var
+ let
$message = $menu.children(selector.message),
html = settings.templates.message(module.add.variables(message))
;
@@ -2867,7 +2867,7 @@
}
},
optionValue: function (value) {
- var
+ let
escapedValue = module.escape.value(value),
$option = $input.find('option[value="' + module.escape.string(escapedValue) + '"]'),
hasOption = $option.length > 0
@@ -2891,7 +2891,7 @@
module.observe.select();
},
userSuggestion: function (value) {
- var
+ let
$addition = $menu.children(selector.addition),
$existingItem = module.get.item(value),
alreadyHasValue = $existingItem && $existingItem.not(selector.addition).length > 0,
@@ -2938,7 +2938,7 @@
module.refreshItems();
},
variables: function (message, term) {
- var
+ let
hasCount = message.search('{count}') !== -1,
hasMaxCount = message.search('{maxCount}') !== -1,
hasTerm = message.search('{term}') !== -1,
@@ -2964,7 +2964,7 @@
$selectedItem = undefined;
addedText = undefined;
}
- var
+ let
currentValue = module.get.values(true),
newValue
;
@@ -3023,11 +3023,11 @@
initialLoad = false;
},
upward: function ($currentMenu) {
- var $element = $currentMenu || $module;
+ let $element = $currentMenu || $module;
$element.removeClass(className.upward);
},
leftward: function ($currentMenu) {
- var $element = $currentMenu || $menu;
+ let $element = $currentMenu || $menu;
$element.removeClass(className.leftward);
},
visible: function () {
@@ -3051,7 +3051,7 @@
module.remove.empty();
},
optionValue: function (value) {
- var
+ let
escapedValue = module.escape.value(value),
$option = $input.find('option[value="' + module.escape.string(escapedValue) + '"]'),
hasOption = $option.length > 0
@@ -3090,7 +3090,7 @@
$selectedItem
.each(function () {
- var
+ let
$selected = $(this),
selectedText = module.get.choiceText($selected),
selectedValue = module.get.choiceValue($selected, selectedText)
@@ -3124,7 +3124,7 @@
$item.removeClass(className.selected);
},
value: function (removedValue, removedText, $removedItem, preventChangeTrigger) {
- var
+ let
values = module.get.values(true),
newValue
;
@@ -3157,7 +3157,7 @@
return values;
},
label: function (value, shouldAnimate) {
- var
+ let
escapedValue = module.escape.value(value),
$labels = $module.find(selector.label),
$removedLabel = $labels.filter('[data-' + metadata.value + '="' + module.escape.string(settings.ignoreCase ? escapedValue.toLowerCase() : escapedValue) + '"]')
@@ -3175,7 +3175,7 @@
module.verbose('Removing labels', $labels);
$labels
.each(function () {
- var
+ let
$label = $(this),
value = $label.data(metadata.value),
stringValue = value !== undefined
@@ -3252,7 +3252,7 @@
return true;
},
firstLetter: function ($item, letter) {
- var
+ let
text,
firstLetter
;
@@ -3281,7 +3281,7 @@
return $menu.children(selector.message).length > 0;
},
label: function (value) {
- var
+ let
escapedValue = module.escape.value(value),
$labels = $module.find(selector.label)
;
@@ -3295,7 +3295,7 @@
return settings.maxSelections && module.get.selectionCount() >= settings.maxSelections;
},
allResultsFiltered: function () {
- var
+ let
$normalResults = $item.not(selector.addition)
;
@@ -3313,7 +3313,7 @@
: module.has.valueMatchingCase(value);
},
valueMatchingCase: function (value) {
- var
+ let
values = module.get.values(true),
hasValue = Array.isArray(values)
? values && ($.inArray(value, values) !== -1)
@@ -3323,7 +3323,7 @@
return !!hasValue;
},
valueIgnoringCase: function (value) {
- var
+ let
values = module.get.values(true),
hasValue = false
;
@@ -3376,7 +3376,7 @@
: $menu.transition && $menu.transition('is animating');
},
leftward: function ($subMenu) {
- var $selectedMenu = $subMenu || $menu;
+ let $selectedMenu = $subMenu || $menu;
return $selectedMenu.hasClass(className.leftward);
},
@@ -3402,7 +3402,7 @@
return initialLoad;
},
inObject: function (needle, object) {
- var
+ let
found = false
;
$.each(object, function (index, property) {
@@ -3428,7 +3428,7 @@
return !module.is.multiple();
},
selectMutation: function (mutations) {
- var
+ let
selectChanged = false
;
$.each(mutations, function (index, mutation) {
@@ -3454,7 +3454,7 @@
return $.inArray(value, module.get.userValues()) !== -1;
},
upward: function ($menu) {
- var $element = $menu || $module;
+ let $element = $menu || $module;
return $element.hasClass(className.upward);
},
@@ -3464,7 +3464,7 @@
: $menu.hasClass(className.visible);
},
verticallyScrollableContext: function () {
- var
+ let
overflowY = $context[0] !== window
? $context.css('overflow-y')
: false
@@ -3473,7 +3473,7 @@
return overflowY === 'auto' || overflowY === 'scroll';
},
horizontallyScrollableContext: function () {
- var
+ let
overflowX = $context[0] !== window
? $context.css('overflow-X')
: false
@@ -3492,7 +3492,7 @@
);
},
openDownward: function ($subMenu) {
- var
+ let
$currentMenu = $subMenu || $menu,
canOpenDownward,
onScreen,
@@ -3539,7 +3539,7 @@
return canOpenDownward;
},
openRightward: function ($subMenu) {
- var
+ let
$currentMenu = $subMenu || $menu,
canOpenRightward = true,
isOffscreenRight = false,
@@ -3586,7 +3586,7 @@
animate: {
show: function (callback, $subMenu) {
- var
+ let
$currentMenu = $subMenu || $menu,
start = $subMenu
? function () {}
@@ -3635,7 +3635,7 @@
}
},
hide: function (callback, $subMenu) {
- var
+ let
$currentMenu = $subMenu || $menu,
start = $subMenu
? function () {}
@@ -3709,7 +3709,7 @@
escape: {
value: function (value) {
- var
+ let
multipleValues = Array.isArray(value),
stringValue = typeof value === 'string',
isUnparsable = !stringValue && !multipleValues,
@@ -3736,7 +3736,7 @@
return text.replace(regExp.escape, '\\$&');
},
htmlEntities: function (string) {
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -3811,7 +3811,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -3832,7 +3832,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -3860,7 +3860,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -3872,7 +3872,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -4168,7 +4168,7 @@
if (preserveHTML) {
return string;
}
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -4192,7 +4192,7 @@
},
// generates dropdown from select values
dropdown: function (select, fields, preserveHTML, className) {
- var
+ let
placeholder = select.placeholder || false,
html = '',
escape = $.fn.dropdown.settings.templates.escape,
@@ -4211,20 +4211,20 @@
// generates just menu from select
menu: function (response, fields, preserveHTML, className) {
- var
+ let
values = response[fields.values] || [],
html = '',
escape = $.fn.dropdown.settings.templates.escape,
deQuote = $.fn.dropdown.settings.templates.deQuote
;
$.each(values, function (index, option) {
- var
+ let
itemType = option[fields.type] || 'item',
isMenu = itemType.indexOf('menu') !== -1
;
if (itemType === 'item' || isMenu) {
- var
+ let
maybeText = option[fields.text]
? ' data-text="' + deQuote(option[fields.text], true) + '"'
: '',
@@ -4267,7 +4267,7 @@
}
html += '';
} else if (itemType === 'header') {
- var
+ let
groupName = escape(option[fields.name] || '', preserveHTML),
groupIcon = deQuote(option[fields.icon] || className.groupIcon)
;
@@ -4290,7 +4290,7 @@
// generates label for multiselect
label: function (value, text, preserveHTML, className) {
- var
+ let
escape = $.fn.dropdown.settings.templates.escape,
deQuote = $.fn.dropdown.settings.templates.deQuote
;
diff --git a/src/definitions/modules/embed.js b/src/definitions/modules/embed.js
index 27388d6e08..67ccec0dcd 100644
--- a/src/definitions/modules/embed.js
+++ b/src/definitions/modules/embed.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.embed = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -36,7 +36,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.embed.settings, parameters)
: $.extend({}, $.fn.embed.settings),
@@ -109,7 +109,7 @@
},
create: function () {
- var
+ let
placeholder = module.get.placeholder()
;
if (placeholder) {
@@ -120,7 +120,7 @@
},
createPlaceholder: function (placeholder) {
- var
+ let
icon = module.get.icon()
;
placeholder = placeholder || module.get.placeholder();
@@ -216,7 +216,7 @@
: module.determine.source());
},
type: function () {
- var source = module.get.source();
+ let source = module.get.source();
return sources[source] !== undefined
? sources[source].type
@@ -236,7 +236,7 @@
}
},
source: function (url) {
- var
+ let
matchedSource = false
;
url = url || module.get.url();
@@ -253,7 +253,7 @@
return matchedSource;
},
icon: function () {
- var
+ let
source = module.get.source()
;
@@ -262,7 +262,7 @@
: false;
},
url: function () {
- var
+ let
id = settings.id || $module.data(metadata.id),
source = settings.source || $module.data(metadata.source),
url
@@ -304,7 +304,7 @@
encode: {
parameters: function (parameters) {
- var
+ let
urlString = [],
index
;
@@ -319,7 +319,7 @@
generate: {
embed: function (url) {
module.debug('Generating embed html');
- var
+ let
source = module.get.source(),
html,
parameters
@@ -335,7 +335,7 @@
return html;
},
parameters: function (source, extraParameters) {
- var
+ let
parameters = sources[source] && sources[source].parameters !== undefined
? sources[source].parameters(settings)
: {}
@@ -424,7 +424,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -445,7 +445,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -476,7 +476,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -488,7 +488,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -644,7 +644,7 @@
return String(string).replace(/"/g, encode ? '"' : '');
},
iframe: function (url, parameters) {
- var
+ let
src = url,
deQuote = $.fn.embed.settings.templates.deQuote
;
@@ -658,7 +658,7 @@
+ ' webkitAllowFullScreen mozallowfullscreen allowFullScreen>';
},
placeholder: function (image, icon) {
- var
+ let
html = '',
deQuote = $.fn.embed.settings.templates.deQuote
;
diff --git a/src/definitions/modules/flyout.js b/src/definitions/modules/flyout.js
index 90d13d9034..e81e26dfcf 100644
--- a/src/definitions/modules/flyout.js
+++ b/src/definitions/modules/flyout.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.flyout = function (parameters) {
- var
+ let
$allModules = $(this),
$window = $(window),
$document = $(document),
@@ -49,7 +49,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.flyout.settings, parameters)
: $.extend({}, $.fn.flyout.settings),
@@ -120,14 +120,14 @@
$module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
}
if (module.has.configActions()) {
- var $actions = $module.find(selector.actions).addClass(settings.classActions);
+ let $actions = $module.find(selector.actions).addClass(settings.classActions);
if ($actions.length === 0) {
$actions = $('', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
} else {
$actions.empty();
}
settings.actions.forEach(function (el) {
- var
+ let
icon = el[fields.icon]
? ''
: '',
@@ -201,12 +201,12 @@
$module.append($closeIcon);
}
if (settings.title !== '') {
- var titleId = '_' + module.get.id() + 'title';
+ let titleId = '_' + module.get.id() + 'title';
$module.attr('aria-labelledby', titleId);
$('', { class: className.header, id: titleId }).appendTo($module);
}
if (settings.content !== '') {
- var descId = '_' + module.get.id() + 'desc';
+ let descId = '_' + module.get.id() + 'desc';
$module.attr('aria-describedby', descId);
$('', { class: className.content, id: descId }).appendTo($module);
}
@@ -247,7 +247,7 @@
event: {
keyboard: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.escape) {
@@ -265,7 +265,7 @@
},
clickaway: function (event) {
if (settings.closable) {
- var
+ let
clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
clickedContext = $context.is(event.target)
;
@@ -283,7 +283,7 @@
module.hide();
},
closeKeyUp: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
@@ -292,7 +292,7 @@
},
inputKeyDown: {
first: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.tab && event.shiftKey) {
@@ -301,7 +301,7 @@
}
},
last: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.tab && !event.shiftKey) {
@@ -410,7 +410,7 @@
add: {
inlineCSS: function () {
- var
+ let
width = module.cache.width || $module.outerWidth(),
height = module.cache.height || $module.outerHeight(),
isRTL = module.is.rtl(),
@@ -567,7 +567,7 @@
},
heights: function () {
module.debug('Setting up heights', $module);
- var
+ let
$header = $module.children(selector.header),
$content = $module.children(selector.content),
$actions = $module.children(selector.actions)
@@ -577,7 +577,7 @@
},
attachEvents: function (selector, event) {
- var
+ let
$toggle = $(selector)
;
event = isFunction(module[event])
@@ -666,7 +666,7 @@
},
hideOthers: function (callback) {
- var
+ let
$otherFlyouts = $flyouts.not($module).filter('.' + className.visible),
flyoutCount = $otherFlyouts.length,
callbackCount = 0
@@ -692,7 +692,7 @@
},
pushPage: function (callback) {
- var
+ let
animate,
dim,
transitionEnd
@@ -730,7 +730,7 @@
},
pullPage: function (callback) {
- var
+ let
animate,
transitionEnd
;
@@ -796,7 +796,7 @@
set: {
autofocus: function () {
- var
+ let
$autofocus = $inputs.filter('[autofocus]'),
$input = $autofocus.length > 0
? $autofocus.first()
@@ -814,10 +814,10 @@
}
},
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -930,7 +930,7 @@
return className.left;
},
transitionEvent: function () {
- var
+ let
element = document.createElement('element'),
transitions = {
transition: 'transitionend',
@@ -969,7 +969,7 @@
save: {
focus: function () {
- var
+ let
$activeElement = $(document.activeElement),
inCurrentFlyout = $activeElement.closest($module).length > 0
;
@@ -979,7 +979,7 @@
},
bodyMargin: function () {
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
- var
+ let
bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
;
@@ -1014,7 +1014,7 @@
},
ie: function () {
if (module.cache.isIE === undefined) {
- var
+ let
isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
isIE = 'ActiveXObject' in window
;
@@ -1024,7 +1024,7 @@
return module.cache.isIE;
},
ios: function () {
- var
+ let
userAgent = navigator.userAgent,
isIOS = userAgent.match(regExp.ios),
isMobileChrome = userAgent.match(regExp.mobileChrome)
@@ -1038,7 +1038,7 @@
return false;
},
mobile: function () {
- var
+ let
userAgent = navigator.userAgent,
isMobile = userAgent.match(regExp.mobile)
;
@@ -1086,10 +1086,10 @@
}
},
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -1106,7 +1106,7 @@
if (preserveHTML) {
return string;
}
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -1181,7 +1181,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1202,7 +1202,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1230,7 +1230,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1242,7 +1242,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -1440,7 +1440,7 @@
$.fn.flyout.settings.templates = {
getArguments: function (args) {
- var queryArguments = [].slice.call(args);
+ let queryArguments = [].slice.call(args);
if ($.isPlainObject(queryArguments[0])) {
return $.extend({
handler: function () {},
@@ -1459,7 +1459,7 @@
};
},
alert: function () {
- var
+ let
settings = this.get.settings(),
args = settings.templates.getArguments(arguments)
;
@@ -1475,7 +1475,7 @@
};
},
confirm: function () {
- var
+ let
settings = this.get.settings(),
args = settings.templates.getArguments(arguments)
;
@@ -1499,7 +1499,7 @@
};
},
prompt: function () {
- var
+ let
$this = this,
settings = this.get.settings(),
args = settings.templates.getArguments(arguments),
@@ -1516,7 +1516,7 @@
text: settings.text.ok,
class: settings.className.ok,
click: function () {
- var
+ let
settings = $this.get.settings(),
inputField = $this.get.element().find(settings.selector.prompt)[0]
;
diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js
index 0db5c3f41a..8a6ae06e2c 100755
--- a/src/definitions/modules/modal.js
+++ b/src/definitions/modules/modal.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.modal = function (parameters) {
- var
+ let
$allModules = $(this),
$window = $(window),
$document = $(document),
@@ -47,7 +47,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.modal.settings, parameters)
: $.extend({}, $.fn.modal.settings),
@@ -113,14 +113,14 @@
$module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
}
if (module.has.configActions()) {
- var $actions = $module.find(selector.actions).addClass(settings.classActions);
+ let $actions = $module.find(selector.actions).addClass(settings.classActions);
if ($actions.length === 0) {
$actions = $('', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
} else {
$actions.empty();
}
settings.actions.forEach(function (el) {
- var
+ let
icon = el[fields.icon]
? ''
: '',
@@ -136,7 +136,7 @@
class: className.button + ' ' + cls,
on: {
click: function () {
- var button = $(this);
+ let button = $(this);
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
return;
}
@@ -187,12 +187,12 @@
$module.append($closeIcon);
}
if (settings.title !== '') {
- var titleId = '_' + module.get.id() + 'title';
+ let titleId = '_' + module.get.id() + 'title';
$module.attr('aria-labelledby', titleId);
$('', { class: className.title, id: titleId }).appendTo($module);
}
if (settings.content !== '') {
- var descId = '_' + module.get.id() + 'desc';
+ let descId = '_' + module.get.id() + 'desc';
$module.attr('aria-describedby', descId);
$('', { class: className.content, id: descId }).appendTo($module);
}
@@ -203,7 +203,7 @@
element = $module[0];
},
dimmer: function () {
- var
+ let
defaultSettings = {
debug: settings.debug,
dimmerName: 'modals',
@@ -306,7 +306,7 @@
},
attachEvents: function (selector, event) {
- var
+ let
$toggle = $(selector)
;
event = isFunction(module[event])
@@ -394,7 +394,7 @@
module.hide();
},
closeKeyUp: function (event) {
- var
+ let
keyCode = event.which
;
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
@@ -403,7 +403,7 @@
},
inputKeyDown: {
first: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.tab && event.shiftKey) {
@@ -412,7 +412,7 @@
}
},
last: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.tab && !event.shiftKey) {
@@ -422,7 +422,7 @@
},
},
mousedown: function (event) {
- var
+ let
$target = $(event.target),
isRtl = module.is.rtl()
;
@@ -451,7 +451,7 @@
return;
}
- var
+ let
$target = $(event.target),
isInModal = $target.closest(selector.modal).length > 0,
isInDOM = $.contains(document.documentElement, event.target)
@@ -473,7 +473,7 @@
module.timer = setTimeout(method, delay);
},
keyboard: function (event) {
- var
+ let
keyCode = event.which
;
if (keyCode === settings.keys.escape) {
@@ -599,7 +599,7 @@
},
hideModal: function (callback, keepDimmed, hideOthersToo) {
- var
+ let
$previousModal = $otherModals.filter('.' + className.active).last()
;
callback = isFunction(callback)
@@ -691,7 +691,7 @@
},
hideAll: function (callback) {
- var
+ let
$visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
;
callback = isFunction(callback)
@@ -699,7 +699,7 @@
: function () {};
if ($visibleModals.length > 0) {
module.debug('Hiding all visible modals');
- var hideOk = true;
+ let hideOk = true;
// check in reverse order trying to hide most top displayed modal first
$($visibleModals.get().reverse()).each(function (index, element) {
if (hideOk) {
@@ -715,7 +715,7 @@
},
hideOthers: function (callback) {
- var
+ let
$visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
;
callback = isFunction(callback)
@@ -749,7 +749,7 @@
save: {
focus: function () {
- var
+ let
$activeElement = $(document.activeElement),
inCurrentModal = $activeElement.closest($module).length > 0
;
@@ -759,7 +759,7 @@
},
bodyMargin: function () {
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
- var
+ let
bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
;
@@ -774,10 +774,10 @@
}
},
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -839,7 +839,7 @@
cacheSizes: function () {
$module.addClass(className.loading);
- var
+ let
scrollHeight = $module.prop('scrollHeight'),
modalWidth = $module.outerWidth(),
modalHeight = $module.outerHeight()
@@ -867,7 +867,7 @@
if (preserveHTML) {
return string;
}
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -911,7 +911,7 @@
return settings.useFlex;
},
fit: function () {
- var
+ let
contextHeight = module.cache.contextHeight,
verticalCenter = module.cache.contextHeight / 2,
topOffset = module.cache.topOffset,
@@ -940,7 +940,7 @@
},
ie: function () {
if (module.cache.isIE === undefined) {
- var
+ let
isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
isIE = 'ActiveXObject' in window
;
@@ -996,7 +996,7 @@
set: {
autofocus: function () {
- var
+ let
$autofocus = $inputs.filter('[autofocus]'),
$input = $autofocus.length > 0
? $autofocus.first()
@@ -1007,12 +1007,12 @@
}
},
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
if (settings.detachable || module.can.fit()) {
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
}
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -1038,7 +1038,7 @@
return;
}
- var
+ let
defaultSettings = {
debug: settings.debug,
dimmerName: 'modals',
@@ -1072,7 +1072,7 @@
},
modalOffset: function () {
if (!settings.detachable) {
- var canFit = module.can.fit();
+ let canFit = module.can.fit();
$module
.css({
top: !$module.hasClass('aligned') && canFit
@@ -1187,7 +1187,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1208,7 +1208,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1236,7 +1236,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1248,7 +1248,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query;
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
@@ -1461,7 +1461,7 @@
$.fn.modal.settings.templates = {
getArguments: function (args) {
- var queryArguments = [].slice.call(args);
+ let queryArguments = [].slice.call(args);
if ($.isPlainObject(queryArguments[0])) {
return $.extend({
handler: function () {},
@@ -1480,7 +1480,7 @@
};
},
alert: function () {
- var
+ let
settings = this.get.settings(),
args = settings.templates.getArguments(arguments),
approveFn = args.handler
@@ -1498,7 +1498,7 @@
};
},
confirm: function () {
- var
+ let
settings = this.get.settings(),
args = settings.templates.getArguments(arguments),
approveFn = function () {
@@ -1526,13 +1526,13 @@
};
},
prompt: function () {
- var
+ let
$this = this,
settings = this.get.settings(),
args = settings.templates.getArguments(arguments),
input = $($.parseHTML(args.content)).filter('.ui.input'),
approveFn = function () {
- var
+ let
settings = $this.get.settings(),
inputField = $this.get.element().find(settings.selector.prompt)[0]
;
diff --git a/src/definitions/modules/nag.js b/src/definitions/modules/nag.js
index 207b14035a..322cf02c0b 100644
--- a/src/definitions/modules/nag.js
+++ b/src/definitions/modules/nag.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.nag = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -33,7 +33,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.nag.settings, parameters)
: $.extend({}, $.fn.nag.settings),
@@ -191,8 +191,8 @@
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent)
;
- var cookieOptions = '';
- for (var option in options) {
+ let cookieOptions = '';
+ for (let option in options) {
if (Object.prototype.hasOwnProperty.call(options, option)) {
cookieOptions += '; ' + option;
if (typeof options[option] === 'string') {
@@ -203,9 +203,9 @@
document.cookie = key + '=' + value + cookieOptions;
},
getItem: function (key) {
- var cookies = document.cookie.split('; ');
- for (var i = 0, il = cookies.length; i < il; i++) {
- var
+ let cookies = document.cookie.split('; ');
+ for (let i = 0, il = cookies.length; i < il; i++) {
+ let
parts = cookies[i].split('='),
foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent)
;
@@ -223,7 +223,7 @@
module.error(error.noStorage);
},
storageOptions: function () {
- var
+ let
options = {}
;
if (settings.expires) {
@@ -252,7 +252,7 @@
storage: {
set: function (key, value) {
- var
+ let
options = module.get.storageOptions()
;
if (storage === window.localStorage && options.expires) {
@@ -267,12 +267,12 @@
}
},
get: function (key) {
- var
+ let
storedValue
;
storedValue = storage.getItem(key);
if (storage === window.localStorage) {
- var expiration = storage.getItem(key + settings.expirationKey);
+ let expiration = storage.getItem(key + settings.expirationKey);
if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
module.debug('Value in localStorage has expired. Deleting key', key);
module.storage.remove(key);
@@ -286,7 +286,7 @@
return storedValue;
},
remove: function (key) {
- var
+ let
options = module.get.storageOptions()
;
options.expires = module.get.expirationDate(-1);
@@ -348,7 +348,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -369,7 +369,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -397,7 +397,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -409,7 +409,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js
index bf7d97187c..26f7d82db2 100644
--- a/src/definitions/modules/popup.js
+++ b/src/definitions/modules/popup.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.popup = function (parameters) {
- var
+ let
$allModules = $(this),
$document = $(document),
$window = $(window),
@@ -42,7 +42,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.popup.settings, parameters)
: $.extend({}, $.fn.popup.settings),
@@ -178,7 +178,7 @@
event: {
start: function (event) {
- var
+ let
delay = $.isPlainObject(settings.delay)
? settings.delay.show
: settings.delay
@@ -189,7 +189,7 @@
}
},
end: function () {
- var
+ let
delay = $.isPlainObject(settings.delay)
? settings.delay.hide
: settings.delay
@@ -221,7 +221,7 @@
});
},
hideGracefully: function (event) {
- var
+ let
$target = $(event.target),
isInDOM = $.contains(document.documentElement, event.target),
inPopup = $target.closest(selector.popup).length > 0
@@ -238,7 +238,7 @@
// generates popup html from metadata
create: function () {
- var
+ let
html = module.get.html(),
title = module.get.title(),
content = module.get.content()
@@ -494,7 +494,7 @@
return $popup.offset();
},
calculations: function () {
- var
+ let
$popupOffsetParent = module.get.offsetParent($popup),
targetElement = $target[0],
isWindowEl = $boundary[0] === window,
@@ -546,7 +546,7 @@
// if popup offset context is not same as target, then adjust calculations
if ($popupOffsetParent[0] !== $offsetParent[0]) {
- var
+ let
popupOffset = $popupOffsetParent.offset()
;
calculations.target.top -= popupOffset.top;
@@ -610,7 +610,7 @@
return false;
},
distanceFromBoundary: function (offset, calculations) {
- var
+ let
distanceFromBoundary = {},
popup,
boundary
@@ -634,7 +634,7 @@
return distanceFromBoundary;
},
offsetParent: function ($element) {
- var
+ let
element = $element !== undefined
? $element[0]
: $target[0],
@@ -642,7 +642,7 @@
$node = $(parentNode)
;
if (parentNode) {
- var
+ let
is2D = $node.css('transform') === 'none',
isStatic = $node.css('position') === 'static',
isBody = $node.is('body')
@@ -673,7 +673,7 @@
};
},
nextPosition: function (position) {
- var
+ let
positions = position.split(' '),
verticalPosition = positions[0],
horizontalPosition = positions[1],
@@ -740,7 +740,7 @@
return;
}
- var
+ let
offset,
distanceAway,
target,
@@ -1094,7 +1094,7 @@
return settings.closable;
},
offstage: function (distanceFromBoundary, position) {
- var
+ let
offstage = []
;
// return boundaries that have been surpassed
@@ -1195,7 +1195,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1216,7 +1216,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1244,7 +1244,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1256,7 +1256,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -1478,7 +1478,7 @@
templates: {
escape: function (string) {
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -1501,7 +1501,7 @@
return string;
},
popup: function (text) {
- var
+ let
html = '',
escape = $.fn.popup.settings.templates.escape
;
diff --git a/src/definitions/modules/progress.js b/src/definitions/modules/progress.js
index 5d81e120a2..68114bec90 100644
--- a/src/definitions/modules/progress.js
+++ b/src/definitions/modules/progress.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.progress = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -36,7 +36,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.progress.settings, parameters)
: $.extend({}, $.fn.progress.settings),
@@ -91,9 +91,9 @@
* @returns {number} A precision. Could be 1, 10, 100, ... 1e+10.
*/
derivePrecision: function (min, total) {
- var precisionPower = 0;
- var precision = 1;
- var ratio = min / total;
+ let precisionPower = 0;
+ let precision = 1;
+ let ratio = min / total;
while (precisionPower < 10) {
ratio *= precision;
if (ratio > 1) {
@@ -155,7 +155,7 @@
read: {
metadata: function () {
- var
+ let
data = {
percent: module.helper.forceArray($module.data(metadata.percent)),
total: $module.data(metadata.total),
@@ -195,7 +195,7 @@
bind: {
transitionEnd: function (callback) {
- var
+ let
transitionEnd = module.get.transitionEnd()
;
$bars
@@ -212,7 +212,7 @@
},
increment: function (incrementValue) {
- var
+ let
startValue,
newValue
;
@@ -229,7 +229,7 @@
module.set.progress(newValue);
},
decrement: function (decrementValue) {
- var
+ let
total = module.get.total(),
startValue,
newValue
@@ -264,7 +264,7 @@
index = 0;
}
- var
+ let
value = module.get.value(index),
total = module.get.total(),
percent = animating
@@ -331,7 +331,7 @@
},
transitionEnd: function () {
- var
+ let
element = document.createElement('element'),
transitions = {
transition: 'transitionend',
@@ -350,7 +350,7 @@
// gets current displayed percentage (if animating values this is the intermediary value)
displayPercent: function (index) {
- var
+ let
$bar = $($bars[index]),
barWidth = $bar.width(),
totalWidth = $module.width(),
@@ -446,14 +446,14 @@
barWidth: function (values) {
module.debug('set bar width with ', values);
values = module.helper.forceArray(values);
- var firstNonZeroIndex = -1;
- var lastNonZeroIndex = -1;
- var valuesSum = module.helper.sum(values);
- var barCounts = $bars.length;
- var isMultiple = barCounts > 1;
- var percents = values.map(function (value, index) {
- var allZero = index === barCounts - 1 && valuesSum === 0;
- var $bar = $($bars[index]);
+ let firstNonZeroIndex = -1;
+ let lastNonZeroIndex = -1;
+ let valuesSum = module.helper.sum(values);
+ let barCounts = $bars.length;
+ let isMultiple = barCounts > 1;
+ let percents = values.map(function (value, index) {
+ let allZero = index === barCounts - 1 && valuesSum === 0;
+ let $bar = $($bars[index]);
if (value === 0 && isMultiple && !allZero) {
$bar.css('display', 'none');
} else {
@@ -473,7 +473,7 @@
return parseFloat(value);
});
values.forEach(function (_, index) {
- var $bar = $($bars[index]);
+ let $bar = $($bars[index]);
$bar.css({
borderTopLeftRadius: index === firstNonZeroIndex ? '' : '0',
borderBottomLeftRadius: index === firstNonZeroIndex ? '' : '0',
@@ -507,10 +507,10 @@
? Math.max(0, Math.min(100, percent))
: percent;
});
- var hasTotal = module.has.total();
- var totalPercent = module.helper.sum(percents);
- var isMultipleValues = percents.length > 1 && hasTotal;
- var sumTotal = module.helper.sum(module.helper.forceArray(module.value));
+ let hasTotal = module.has.total();
+ let totalPercent = module.helper.sum(percents);
+ let isMultipleValues = percents.length > 1 && hasTotal;
+ let sumTotal = module.helper.sum(module.helper.forceArray(module.value));
if (isMultipleValues && sumTotal > module.total) {
// Sum values instead of pecents to avoid precision issues when summing floats
module.error(error.sumExceedsTotal, sumTotal, module.total);
@@ -520,14 +520,14 @@
} else if (totalPercent < 0) {
module.error(error.tooLow, totalPercent);
} else {
- var autoPrecision = settings.precision > 0
+ let autoPrecision = settings.precision > 0
? settings.precision
: (isMultipleValues
? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
: 0);
// round display percentage
- var roundedPercents = percents.map(function (percent) {
+ let roundedPercents = percents.map(function (percent) {
return autoPrecision > 0
? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
: Math.round(percent)
@@ -547,7 +547,7 @@
settings.onChange.call(element, percents, module.value, module.total);
},
labelInterval: function () {
- var
+ let
animationCallback = function () {
module.verbose('Bar finished animating, removing continuous label updates');
clearInterval(module.interval);
@@ -559,7 +559,7 @@
module.bind.transitionEnd(animationCallback);
animating = true;
module.interval = setInterval(function () {
- var
+ let
isInDOM = $.contains(document.documentElement, element)
;
if (!isInDOM) {
@@ -607,7 +607,7 @@
},
barLabel: function (text) {
$progresses.each(function (index, element) {
- var $progress = $(element);
+ let $progress = $(element);
if (text !== undefined) {
$progress.text(module.get.text(text, index));
} else if (settings.label === 'ratio' && module.has.total()) {
@@ -713,7 +713,7 @@
update: {
toNextValue: function () {
- var
+ let
nextValue = module.nextValue
;
if (nextValue) {
@@ -723,12 +723,12 @@
}
},
progress: function (values) {
- var hasTotal = module.has.total();
+ let hasTotal = module.has.total();
if (hasTotal) {
module.set.value(values);
}
- var percentCompletes = module.helper.forceArray(values).map(function (value) {
- var
+ let percentCompletes = module.helper.forceArray(values).map(function (value) {
+ let
percentComplete
;
value = module.get.numericValue(value);
@@ -801,7 +801,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -822,7 +822,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -850,7 +850,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -862,7 +862,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/rating.js b/src/definitions/modules/rating.js
index 19e08272d5..f2a802f6d2 100644
--- a/src/definitions/modules/rating.js
+++ b/src/definitions/modules/rating.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.rating = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -33,7 +33,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.rating.settings, parameters)
: $.extend({}, $.fn.rating.settings),
@@ -99,7 +99,7 @@
setup: {
layout: function () {
- var
+ let
maxRating = module.get.maxRating(),
icon = module.get.icon(),
html = $.fn.rating.settings.templates.icon(maxRating, icon)
@@ -114,7 +114,7 @@
event: {
mouseenter: function () {
- var
+ let
$activeIcon = $(this)
;
$activeIcon
@@ -139,7 +139,7 @@
;
},
click: function () {
- var
+ let
$activeIcon = $(this),
currentRating = module.get.rating(),
rating = $icon.index($activeIcon) + 1,
@@ -210,7 +210,7 @@
get: {
icon: function () {
- var icon = $module.data(metadata.icon);
+ let icon = $module.data(metadata.icon);
if (icon) {
$module.removeData(metadata.icon);
}
@@ -236,7 +236,7 @@
return settings.maxRating;
},
rating: function () {
- var
+ let
currentRating = $icon.filter('.' + className.active).length
;
module.verbose('Current rating retrieved', currentRating);
@@ -247,7 +247,7 @@
set: {
rating: function (rating) {
- var
+ let
ratingIndex = Math.floor(
rating - 1 >= 0
? rating - 1
@@ -350,7 +350,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -371,7 +371,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -402,7 +402,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -414,7 +414,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -522,7 +522,7 @@
return String(string).replace(/"/g, encode ? '"' : '');
},
icon: function (maxRating, iconClass) {
- var
+ let
icon = 1,
html = '',
deQuote = $.fn.rating.settings.templates.deQuote
diff --git a/src/definitions/modules/search.js b/src/definitions/modules/search.js
index f648b4759f..6fe3092203 100644
--- a/src/definitions/modules/search.js
+++ b/src/definitions/modules/search.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.search = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -33,7 +33,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.search.settings, parameters)
: $.extend({}, $.fn.search.settings),
@@ -165,7 +165,7 @@
}
},
blur: function (event) {
- var
+ let
pageLostFocus = document.activeElement === this,
callback = function () {
module.cancel.query();
@@ -206,7 +206,7 @@
},
click: function (event) {
module.debug('Search result selected');
- var
+ let
$result = $(this),
$title = $result.find(selector.title).eq(0),
$link = $result.is('a[href]')
@@ -221,7 +221,7 @@
results = module.get.results(),
result = $result.data(metadata.result) || module.get.result(value, results)
;
- var oldValue = module.get.value();
+ let oldValue = module.get.value();
if (isFunction(settings.onSelect)) {
if (settings.onSelect.call(element, result, results) === false) {
module.debug('Custom onSelect callback cancelled default select action');
@@ -247,7 +247,7 @@
},
},
ensureVisible: function ($el) {
- var
+ let
elTop,
elBottom,
resultsScrollTop,
@@ -269,7 +269,7 @@
}
},
handleKeyboard: function (event) {
- var
+ let
// force selector refresh
$result = $module.find(selector.result),
$category = $module.find(selector.category),
@@ -356,7 +356,7 @@
setup: {
api: function (searchTerm, callback) {
- var
+ let
apiSettings = {
debug: settings.debug,
on: false,
@@ -426,7 +426,7 @@
if (!event.target) {
return;
}
- var
+ let
$target = $(event.target),
isInDOM = $.contains(document.documentElement, event.target)
;
@@ -456,7 +456,7 @@
}
},
inputEvent: function () {
- var
+ let
prompt = $prompt[0],
inputEvent = prompt !== undefined && prompt.oninput !== undefined
? 'input'
@@ -474,7 +474,7 @@
return $module.data(metadata.results);
},
result: function (value, results) {
- var
+ let
result = false
;
value = value !== undefined
@@ -553,7 +553,7 @@
callback = isFunction(callback)
? callback
: function () {};
- var
+ let
searchTerm = module.get.value(),
cache = module.read.cache(searchTerm)
;
@@ -585,7 +585,7 @@
search: {
local: function (searchTerm) {
- var
+ let
results = module.search.object(searchTerm, settings.source),
searchHTML
;
@@ -624,7 +624,7 @@
},
object: function (searchTerm, source, searchFields) {
searchTerm = module.remove.diacritics(String(searchTerm));
- var
+ let
results = [],
exactResults = [],
fuzzyResults = [],
@@ -633,7 +633,7 @@
// avoid duplicates when pushing results
addResult = function (array, result) {
- var
+ let
notResult = $.inArray(result, results) === -1,
notFuzzyResult = $.inArray(result, fuzzyResults) === -1,
notExactResults = $.inArray(result, exactResults) === -1
@@ -662,11 +662,11 @@
// iterate through search fields looking for matches
$.each(searchFields, function (index, field) {
$.each(source, function (label, content) {
- var
+ let
fieldExists = (typeof content[field] === 'string') || (typeof content[field] === 'number')
;
if (fieldExists) {
- var text;
+ let text;
text = typeof content[field] === 'string'
? module.remove.diacritics(content[field])
: content[field].toString();
@@ -696,7 +696,7 @@
return term.indexOf(query) > -1;
},
fuzzySearch: function (query, term) {
- var
+ let
termLength = term.length,
queryLength = query.length
;
@@ -711,8 +711,8 @@
if (queryLength === termLength) {
return query === term;
}
- for (var characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {
- var
+ for (let characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {
+ let
continueSearch = false,
queryCharacter = query.charCodeAt(characterIndex)
;
@@ -735,11 +735,11 @@
parse: {
response: function (response, searchTerm) {
if (Array.isArray(response)) {
- var o = {};
+ let o = {};
o[fields.results] = response;
response = o;
}
- var
+ let
searchHTML = module.generateResults(response)
;
module.verbose('Parsing server response', response);
@@ -767,7 +767,7 @@
has: {
minimumCharacters: function () {
- var
+ let
searchTerm = module.get.value(),
numCharacters = searchTerm.length
;
@@ -778,7 +778,7 @@
if ($results.length === 0) {
return false;
}
- var
+ let
html = $results.html()
;
@@ -788,7 +788,7 @@
clear: {
cache: function (value) {
- var
+ let
cache = $module.data(metadata.cache)
;
if (!value) {
@@ -804,7 +804,7 @@
read: {
cache: function (name) {
- var
+ let
cache = $module.data(metadata.cache)
;
if (settings.cache) {
@@ -821,7 +821,7 @@
create: {
categoryResults: function (results) {
- var
+ let
categoryResults = {}
;
$.each(results, function (index, result) {
@@ -842,7 +842,7 @@
return categoryResults;
},
id: function (resultIndex, categoryIndex) {
- var
+ let
resultID = resultIndex + 1, // not zero indexed
letterID,
id
@@ -872,7 +872,7 @@
inject: {
result: function (result, resultIndex, categoryIndex) {
module.verbose('Injecting result into results');
- var
+ let
$selectedResult = categoryIndex !== undefined
? $results
.children().eq(categoryIndex)
@@ -890,7 +890,7 @@
},
id: function (results) {
module.debug('Injecting unique ids into results');
- var
+ let
// since results may be object, we must use counters
categoryIndex = 0,
resultIndex = 0
@@ -934,7 +934,7 @@
write: {
cache: function (name, value) {
- var
+ let
cache = $module.data(metadata.cache) !== undefined
? $module.data(metadata.cache)
: {}
@@ -991,7 +991,7 @@
silent: settings.silent,
duration: settings.duration,
onShow: function () {
- var $firstResult = $module.find(selector.result).eq(0);
+ let $firstResult = $module.find(selector.result).eq(0);
module.ensureVisible($firstResult);
},
onComplete: function () {
@@ -1043,7 +1043,7 @@
generateResults: function (response) {
module.debug('Generating html from response', response);
- var
+ let
template = settings.templates[settings.type],
isProperObject = $.isPlainObject(response[fields.results]) && !$.isEmptyObject(response[fields.results]),
isProperArray = Array.isArray(response[fields.results]) && response[fields.results].length > 0,
@@ -1126,7 +1126,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1147,7 +1147,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1178,7 +1178,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1190,7 +1190,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -1393,7 +1393,7 @@
if (preserveHTML) {
return string;
}
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -1415,7 +1415,7 @@
return string;
},
message: function (message, type, header) {
- var
+ let
html = ''
;
if (message !== undefined && type !== undefined) {
@@ -1432,7 +1432,7 @@
return html;
},
category: function (response, fields, preserveHTML) {
- var
+ let
html = '',
escape = $.fn.search.settings.templates.escape
;
@@ -1495,7 +1495,7 @@
return false;
},
standard: function (response, fields, preserveHTML) {
- var
+ let
html = '',
escape = $.fn.search.settings.templates.escape
;
diff --git a/src/definitions/modules/shape.js b/src/definitions/modules/shape.js
index 6f325f01cc..8d5c6a9b52 100644
--- a/src/definitions/modules/shape.js
+++ b/src/definitions/modules/shape.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.shape = function (parameters) {
- var
+ let
$allModules = $(this),
time = Date.now(),
@@ -42,7 +42,7 @@
;
$allModules.each(function () {
- var
+ let
moduleSelector = $allModules.selector || '',
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.shape.settings, parameters)
@@ -107,7 +107,7 @@
repaint: function () {
module.verbose('Forcing repaint event');
- var
+ let
shape = $sides[0] || document.createElement('div'),
fakeAssignment = shape.offsetWidth
;
@@ -227,7 +227,7 @@
},
currentStageSize: function () {
- var
+ let
$activeSide = $side.filter('.' + settings.className.active),
width = $activeSide.outerWidth(true),
height = $activeSide.outerHeight(true)
@@ -241,7 +241,7 @@
},
stageSize: function () {
- var
+ let
$clone = $module.clone().addClass(className.loading),
$side = $clone.find('>' + selector.sides + '>' + selector.side),
$activeSide = $side.filter('.' + settings.className.active),
@@ -311,7 +311,7 @@
return;
}
- var
+ let
transform = module.get.transform[type]()
;
if (!module.is.animating()) {
@@ -354,7 +354,7 @@
transform: {
up: function () {
- var
+ let
translateZ = $activeSide.outerHeight(true) / 2,
translateY = $nextSide.outerHeight(true) - translateZ
;
@@ -365,7 +365,7 @@
},
down: function () {
- var
+ let
translate = {
z: $activeSide.outerHeight(true) / 2,
}
@@ -377,7 +377,7 @@
},
left: function () {
- var
+ let
translateZ = $activeSide.outerWidth(true) / 2,
translateX = $nextSide.outerWidth(true) - translateZ
;
@@ -388,7 +388,7 @@
},
right: function () {
- var
+ let
translate = {
z: $activeSide.outerWidth(true) / 2,
}
@@ -400,7 +400,7 @@
},
over: function () {
- var
+ let
translate = {
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
}
@@ -412,7 +412,7 @@
},
back: function () {
- var
+ let
translate = {
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
}
@@ -425,7 +425,7 @@
},
transitionEvent: function () {
- var
+ let
element = document.createElement('element'),
transitions = {
transition: 'transitionend',
@@ -453,7 +453,7 @@
stage: {
above: function () {
- var
+ let
box = {
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
depth: {
@@ -478,7 +478,7 @@
},
below: function () {
- var
+ let
box = {
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
depth: {
@@ -503,7 +503,7 @@
},
left: function () {
- var
+ let
height = {
active: $activeSide.outerWidth(true),
next: $nextSide.outerWidth(true),
@@ -532,7 +532,7 @@
},
right: function () {
- var
+ let
height = {
active: $activeSide.outerWidth(true),
next: $nextSide.outerWidth(true),
@@ -561,7 +561,7 @@
},
behind: function () {
- var
+ let
height = {
active: $activeSide.outerWidth(true),
next: $nextSide.outerWidth(true),
@@ -640,7 +640,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -661,7 +661,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -692,7 +692,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -704,7 +704,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -746,7 +746,7 @@
if (instance === undefined) {
module.initialize();
}
- var $inputs = $module.find('input');
+ let $inputs = $module.find('input');
if ($inputs.length > 0) {
$inputs.trigger('blur');
setTimeout(function () {
diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js
index c9753a9523..9665d1c8ba 100644
--- a/src/definitions/modules/sidebar.js
+++ b/src/definitions/modules/sidebar.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.sidebar = function (parameters) {
- var
+ let
$allModules = $(this),
$window = $(window),
$document = $(document),
@@ -48,7 +48,7 @@
returnedValue;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.sidebar.settings, parameters)
: $.extend({}, $.fn.sidebar.settings),
@@ -142,7 +142,7 @@
event: {
clickaway: function (event) {
if (settings.closable) {
- var
+ let
clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
clickedContext = $context.is(event.target)
;
@@ -219,7 +219,7 @@
add: {
inlineCSS: function () {
- var
+ let
width = module.cache.width || $module.outerWidth(),
height = module.cache.height || $module.outerHeight(),
isRTL = module.is.rtl(),
@@ -308,7 +308,7 @@
repaint: function () {
module.verbose('Forcing repaint event');
element.style.display = 'none';
- var ignored = element.offsetHeight;
+ let ignored = element.offsetHeight;
element.scrollTop = element.scrollTop; // eslint-disable-line no-self-assign
element.style.display = '';
},
@@ -346,7 +346,7 @@
},
attachEvents: function (selector, event) {
- var
+ let
$toggle = $(selector)
;
event = isFunction(module[event])
@@ -373,7 +373,7 @@
save: {
bodyMargin: function () {
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
- var
+ let
bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
;
@@ -447,7 +447,7 @@
},
hideOthers: function (callback) {
- var
+ let
$otherSidebars = $sidebars.not($module).filter('.' + className.visible),
sidebarCount = $otherSidebars.length,
callbackCount = 0
@@ -473,7 +473,7 @@
},
pushPage: function (callback) {
- var
+ let
transition = module.get.transition(),
$transition = transition === 'overlay' || module.othersActive()
? $module
@@ -519,7 +519,7 @@
},
pullPage: function (callback) {
- var
+ let
transition = module.get.transition(),
$transition = transition === 'overlay' || module.othersActive()
? $module
@@ -584,10 +584,10 @@
set: {
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -694,10 +694,10 @@
},
restore: {
bodyMargin: function () {
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
- var
+ let
el = $(this),
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
;
@@ -720,7 +720,7 @@
return className.left;
},
transition: function () {
- var
+ let
direction = module.get.direction(),
transition
;
@@ -736,7 +736,7 @@
return transition;
},
transitionEvent: function () {
- var
+ let
element = document.createElement('element'),
transitions = {
transition: 'transitionend',
@@ -785,7 +785,7 @@
},
ie: function () {
if (module.cache.isIE === undefined) {
- var
+ let
isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
isIE = 'ActiveXObject' in window
;
@@ -796,7 +796,7 @@
},
ios: function () {
- var
+ let
userAgent = navigator.userAgent,
isIOS = userAgent.match(regExp.ios),
isMobileChrome = userAgent.match(regExp.mobileChrome)
@@ -810,7 +810,7 @@
return false;
},
mobile: function () {
- var
+ let
userAgent = navigator.userAgent,
isMobile = userAgent.match(regExp.mobile)
;
@@ -903,7 +903,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -924,7 +924,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -952,7 +952,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -964,7 +964,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/slider.js b/src/definitions/modules/slider.js
index 7711a2307b..2c6fa27b1d 100644
--- a/src/definitions/modules/slider.js
+++ b/src/definitions/modules/slider.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.slider = function (parameters) {
- var
+ let
$allModules = $(this),
$document = $(document),
$window = $(window),
@@ -50,7 +50,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.slider.settings, parameters)
: $.extend({}, $.fn.slider.settings),
@@ -173,7 +173,7 @@
}
},
customLabel: function () {
- var
+ let
$children = $labels.find('.label'),
numChildren = $children.length,
min = module.get.min(),
@@ -181,7 +181,7 @@
ratio
;
$children.each(function (index) {
- var
+ let
$child = $(this),
attrValue = $child.attr('data-value')
;
@@ -203,8 +203,8 @@
} else {
$labels = $module.append('').find('.labels');
}
- for (var i = 0, len = module.get.numLabels(); i <= len; i++) {
- var
+ for (let i = 0, len = module.get.numLabels(); i <= len; i++) {
+ let
labelText = module.get.label(i),
$label = labelText !== ''
? (!(i % module.get.gapRatio())
@@ -299,7 +299,7 @@
down: function (event) {
event.preventDefault();
if (module.is.range()) {
- var
+ let
eventPos = module.determine.eventPos(event),
newPos = module.determine.pos(eventPos)
;
@@ -330,7 +330,7 @@
return;
}
$currThumb = $(event.target);
- var touchEvent = event.touches ? event : event.originalEvent;
+ let touchEvent = event.touches ? event : event.originalEvent;
touchIdentifier = touchEvent.targetTouches[0].identifier;
if (previousValue === undefined) {
previousValue = module.get.currentThumbValue();
@@ -344,16 +344,16 @@
// touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
return;
}
- var value = module.determine.valueFromEvent(event);
+ let value = module.determine.valueFromEvent(event);
if (event.type === 'mousemove' && $currThumb === undefined) {
- var
+ let
eventPos = module.determine.eventPos(event),
newPos = module.determine.pos(eventPos)
;
$currThumb = initialPosition > newPos ? $thumb : $secondThumb;
}
if (module.get.step() === 0 || module.is.smooth()) {
- var
+ let
thumbVal = module.thumbVal,
secondThumbVal = module.secondThumbVal,
thumbSmoothVal = module.determine.smoothValueFromEvent(event)
@@ -386,7 +386,7 @@
// touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
return;
}
- var value = module.determine.valueFromEvent(event);
+ let value = module.determine.valueFromEvent(event);
module.set.value(value);
module.unbind.slidingEvents();
touchIdentifier = undefined;
@@ -410,7 +410,7 @@
$document.trigger(event);
}
if (first || module.is.focused()) {
- var step = module.determine.keyMovement(event);
+ let step = module.determine.keyMovement(event);
if (step !== NO_STEP) {
event.preventDefault();
switch (step) {
@@ -466,7 +466,7 @@
if (!multiplier) {
multiplier = 1;
}
- var
+ let
step = module.get.step(),
currValue = module.get.currentThumbValue()
;
@@ -474,7 +474,7 @@
if (step > 0) {
module.set.value(currValue + step * multiplier);
} else if (step === 0) {
- var
+ let
precision = module.get.precision(),
newValue = currValue + (multiplier / precision)
;
@@ -486,7 +486,7 @@
if (!multiplier) {
multiplier = 1;
}
- var
+ let
step = module.get.step(),
currValue = module.get.currentThumbValue()
;
@@ -494,7 +494,7 @@
if (step > 0) {
module.set.value(currValue - step * multiplier);
} else if (step === 0) {
- var
+ let
precision = module.get.precision(),
newValue = currValue - (multiplier / precision)
;
@@ -558,7 +558,7 @@
return module.is.reversed() ? module.get.trackLeft() : module.get.trackLeft() + module.get.trackLength();
},
trackStartMargin: function () {
- var margin;
+ let margin;
if (module.is.vertical()) {
margin = module.is.reversed() ? $module.css('padding-bottom') : $module.css('padding-top');
} else {
@@ -568,7 +568,7 @@
return margin || '0px';
},
trackEndMargin: function () {
- var margin;
+ let margin;
if (module.is.vertical()) {
margin = module.is.reversed() ? $module.css('padding-top') : $module.css('padding-bottom');
} else {
@@ -578,17 +578,17 @@
return margin || '0px';
},
precision: function () {
- var
+ let
decimalPlaces,
step = module.get.step()
;
if (step !== 0) {
- var split = String(step).split('.');
+ let split = String(step).split('.');
decimalPlaces = split.length === 2 ? split[1].length : 0;
} else {
decimalPlaces = settings.decimalPlaces;
}
- var precision = Math.pow(10, decimalPlaces);
+ let precision = Math.pow(10, decimalPlaces);
module.debug('Precision determined', precision);
return precision;
@@ -597,7 +597,7 @@
return settings.min;
},
max: function () {
- var
+ let
step = module.get.step(),
min = module.get.min(),
quotient = step === 0 ? 0 : Math.floor((settings.max - min) / step),
@@ -610,7 +610,7 @@
return settings.step;
},
numLabels: function () {
- var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
+ let value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
module.debug('Determined that there should be ' + value + ' labels');
return value;
@@ -677,10 +677,10 @@
}
},
gapRatio: function () {
- var gapRatio = 1;
+ let gapRatio = 1;
if (settings.autoAdjustLabels) {
- var
+ let
numLabels = module.get.numLabels(),
trackLength = module.get.trackLength(),
gapCounter = 1
@@ -710,7 +710,7 @@
: pagePos - module.get.trackOffset() - module.get.trackStartPos();
},
closestThumb: function (eventPos) {
- var
+ let
thumbPos = parseFloat(module.determine.thumbPos($thumb)),
thumbDelta = Math.abs(eventPos - thumbPos),
secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
@@ -723,7 +723,7 @@
return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
},
closestThumbPos: function (eventPos) {
- var
+ let
thumbPos = parseFloat(module.determine.thumbPos($thumb)),
thumbDelta = Math.abs(eventPos - thumbPos),
secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
@@ -733,7 +733,7 @@
return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
},
thumbPos: function ($element) {
- var
+ let
pos = module.is.vertical()
? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
: (module.is.reversed() ? $element.css('right') : $element.css('left'))
@@ -742,7 +742,7 @@
return pos;
},
positionFromValue: function (val) {
- var
+ let
min = module.get.min(),
max = module.get.max(),
value = val > max
@@ -757,7 +757,7 @@
return position;
},
positionFromRatio: function (ratio) {
- var
+ let
trackLength = module.get.trackLength(),
step = module.get.step(),
position = Math.round(ratio * trackLength),
@@ -767,7 +767,7 @@
return adjustedPos;
},
valueFromEvent: function (event) {
- var
+ let
eventPos = module.determine.eventPos(event),
newPos = module.determine.pos(eventPos),
value
@@ -783,7 +783,7 @@
return value;
},
smoothValueFromEvent: function (event) {
- var
+ let
min = module.get.min(),
max = module.get.max(),
trackLength = module.get.trackLength(),
@@ -805,24 +805,24 @@
},
eventPos: function (event) {
if (event.type === 'touchmove' || event.type === 'touchend') {
- var
+ let
touchEvent = event.touches ? event : event.originalEvent,
touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
- for (var i = 0; i < touchEvent.touches.length; i++) {
+ for (let i = 0; i < touchEvent.touches.length; i++) {
if (touchEvent.touches[i].identifier === touchIdentifier) {
touch = touchEvent.touches[i];
break;
}
}
- var
+ let
touchY = touch.pageY,
touchX = touch.pageX
;
return module.is.vertical() ? touchY : touchX;
}
- var
+ let
clickY = event.pageY || event.originalEvent.pageY,
clickX = event.pageX || event.originalEvent.pageX
;
@@ -830,7 +830,7 @@
return module.is.vertical() ? clickY : clickX;
},
value: function (position) {
- var
+ let
startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos(),
endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos(),
ratio = (position - startPos) / (endPos - startPos),
@@ -850,7 +850,7 @@
return Math.round((difference + module.get.min()) * precision) / precision;
},
keyMovement: function (event) {
- var
+ let
key = event.which,
downArrow = module.is.vertical()
? (module.is.reversed() ? keys.downArrow : keys.upArrow)
@@ -883,7 +883,7 @@
},
handleNewValuePosition: function (val) {
- var
+ let
min = module.get.min(),
max = module.get.max(),
newPos
@@ -901,7 +901,7 @@
set: {
value: function (newValue, fireChange) {
fireChange = fireChange !== false;
- var toReset = previousValue === undefined;
+ let toReset = previousValue === undefined;
previousValue = previousValue === undefined ? module.get.value() : previousValue;
module.update.value(newValue, function (value, thumbVal, secondThumbVal) {
if ((!initialLoad || settings.fireOnInit) && fireChange) {
@@ -918,7 +918,7 @@
rangeValue: function (first, second, fireChange) {
fireChange = fireChange !== false;
if (module.is.range()) {
- var
+ let
min = module.get.min(),
max = module.get.max(),
toReset = previousValue === undefined
@@ -953,7 +953,7 @@
}
},
position: function (position, which) {
- var thumbVal = module.determine.value(position);
+ let thumbVal = module.determine.value(position);
if (which === 'second') {
module.secondThumbVal = thumbVal;
module.update.position(thumbVal, $secondThumb);
@@ -968,7 +968,7 @@
update: {
value: function (newValue, callback) {
- var
+ let
min = module.get.min(),
max = module.get.max()
;
@@ -1004,7 +1004,7 @@
}
},
position: function (newValue, $element) {
- var
+ let
newPos = module.handleNewValuePosition(newValue),
$targetThumb = $element || $currThumb,
thumbVal = module.thumbVal || module.get.min(),
@@ -1022,7 +1022,7 @@
position = newPos;
thumbVal = newValue;
}
- var
+ let
trackPosValue,
thumbPosValue,
min = module.get.min(),
@@ -1053,7 +1053,7 @@
module.debug('Setting slider position to ' + newPos);
},
labelPosition: function (ratio, $label) {
- var
+ let
startMargin = module.get.trackStartMargin(),
endMargin = module.get.trackEndMargin(),
posDir = module.is.vertical()
@@ -1063,7 +1063,7 @@
? ' - '
: ' + '
;
- var position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
+ let position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
$label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
},
},
@@ -1079,7 +1079,7 @@
read: {
metadata: function () {
- var
+ let
data = {
thumbVal: $module.data(metadata.thumbVal),
secondThumbVal: $module.data(metadata.secondThumbVal),
@@ -1160,7 +1160,7 @@
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -1181,7 +1181,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -1210,7 +1210,7 @@
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -1222,7 +1222,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js
index cd7c912886..3ff9f9e8a5 100755
--- a/src/definitions/modules/sticky.js
+++ b/src/definitions/modules/sticky.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.sticky = function (parameters) {
- var
+ let
$allModules = $(this),
$document = $(document),
moduleSelector = $allModules.selector || '',
@@ -35,7 +35,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.sticky.settings, parameters)
: $.extend({}, $.fn.sticky.settings),
@@ -232,7 +232,7 @@
supports: {
sticky: function () {
- var
+ let
$element = $('')
;
$element.addClass(className.supported);
@@ -249,7 +249,7 @@
module.elementScroll = scroll;
},
positions: function () {
- var
+ let
scrollContext = {
height: $scroll.height(),
},
@@ -307,7 +307,7 @@
get: {
direction: function (scroll) {
- var
+ let
direction = 'down'
;
scroll = scroll || $scroll.scrollTop();
@@ -336,7 +336,7 @@
elementScroll: function (scroll) {
scroll = scroll || $scroll.scrollTop();
- var
+ let
element = module.cache.element,
scrollContext = module.cache.scrollContext,
delta = module.get.scrollChange(scroll),
@@ -381,7 +381,7 @@
;
},
containerSize: function () {
- var
+ let
tagName = $container[0].tagName
;
if (tagName === 'HTML' || tagName === 'body') {
@@ -389,7 +389,7 @@
// module.error(error.container, tagName, $module);
module.determineContainer();
} else {
- var tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
+ let tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
if (tallestHeight - $container.outerHeight() > settings.jitter) {
module.debug('Context is taller than container. Specifying exact height for container', module.cache.context.height);
$container.css({
@@ -409,7 +409,7 @@
}
},
minimumSize: function () {
- var
+ let
element = module.cache.element
;
$container
@@ -467,7 +467,7 @@
},
stick: function (scrollPosition) {
- var
+ let
cachedPosition = scrollPosition || $scroll.scrollTop(),
cache = module.cache,
fits = cache.fits,
@@ -734,7 +734,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -755,7 +755,7 @@
module.performance.timer = setTimeout(module.performance.display, 0);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -783,7 +783,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -795,7 +795,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js
index 8ed375d8a3..0b33289939 100644
--- a/src/definitions/modules/tab.js
+++ b/src/definitions/modules/tab.js
@@ -24,7 +24,7 @@
: globalThis;
$.fn.tab = function (parameters) {
- var
+ let
// use window context if none specified
$allModules = isFunction(this)
? $(window)
@@ -43,7 +43,7 @@
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.tab.settings, parameters)
: $.extend({}, $.fn.tab.settings),
@@ -93,14 +93,14 @@
initializedHistory = true;
}
- var activeTab = module.determine.activeTab();
+ let activeTab = module.determine.activeTab();
if (settings.autoTabActivation && instance === undefined && activeTab === null) {
activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
module.debug('No active tab detected, setting tab active', activeTab);
module.changeTab(activeTab);
}
if (activeTab !== null && settings.history) {
- var autoUpdate = $.address.autoUpdate();
+ let autoUpdate = $.address.autoUpdate();
$.address.autoUpdate(false);
$.address.value(activeTab);
$.address.autoUpdate(autoUpdate);
@@ -138,7 +138,7 @@
},
determineTabs: function () {
- var
+ let
$reference
;
@@ -214,7 +214,7 @@
event: {
click: function (event) {
- var
+ let
tabPath = $(this).data(metadata.tab)
;
if (tabPath !== undefined) {
@@ -232,7 +232,7 @@
},
history: {
change: function (event) {
- var
+ let
tabPath = event.pathNames.join('/') || module.get.initialPath(),
pageTitle = settings.templates.determineTitle(tabPath) || false
;
@@ -285,7 +285,7 @@
set: {
auto: function () {
- var
+ let
url = typeof settings.path === 'string'
? settings.path.replace(/\/$/, '') + '/{$tab}'
: '/{$tab}'
@@ -300,7 +300,7 @@
}
},
loading: function (tabPath) {
- var
+ let
$tab = module.get.tabElement(tabPath),
isLoading = $tab.hasClass(className.loading)
;
@@ -322,7 +322,7 @@
},
changeTab: function (tabPath) {
- var
+ let
pushStateAvailable = window.history && window.history.pushState,
shouldIgnoreLoad = pushStateAvailable && settings.ignoreFirstLoad && firstLoad,
remoteContent = settings.auto || $.isPlainObject(settings.apiSettings),
@@ -333,7 +333,7 @@
;
tabPath = module.utilities.arrayToPath(pathArray);
$.each(pathArray, function (index, tab) {
- var
+ let
currentPathArray = pathArray.slice(0, index + 1),
currentPath = module.utilities.arrayToPath(currentPathArray),
@@ -430,7 +430,7 @@
},
scrollTo: function ($element) {
- var
+ let
scrollOffset = $element && $element.length > 0
? $element.offset().top
: false
@@ -443,7 +443,7 @@
update: {
content: function (tabPath, html, evaluateScripts) {
- var
+ let
$tab = module.get.tabElement(tabPath),
tab = $tab[0]
;
@@ -470,7 +470,7 @@
fetch: {
content: function (tabPath, fullTabPath) {
- var
+ let
$tab = module.get.tabElement(tabPath),
apiSettings = {
dataType: 'html',
@@ -498,7 +498,7 @@
module.cache.add(fullTabPath, true);
} else if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && $tab.children().length > 0) {
setTimeout(function () {
- var
+ let
$clone = $tab.children().clone(true)
;
$clone = $clone.not('script');
@@ -552,7 +552,7 @@
module.activate.navigation(tabPath);
},
tab: function (tabPath) {
- var
+ let
$tab = module.get.tabElement(tabPath),
$deactiveTabs = settings.deactivate === 'siblings'
? $tab.siblings($tabs)
@@ -573,7 +573,7 @@
}
},
navigation: function (tabPath) {
- var
+ let
$navigation = module.get.navElement(tabPath),
$deactiveNavigation = settings.deactivate === 'siblings'
? $navigation.siblings($allModules)
@@ -629,7 +629,7 @@
return module.utilities.pathToArray(module.get.defaultPath(tabPath));
},
defaultPath: function (tabPath) {
- var
+ let
$defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
defaultTab = $defaultNav.data(metadata.tab) || false
;
@@ -654,7 +654,7 @@
return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
},
tabElement: function (tabPath) {
- var
+ let
$fullPathTab,
$simplePathTab,
tabPathArray,
@@ -677,13 +677,13 @@
determine: {
activeTab: function () {
- var activeTab = null;
+ let activeTab = null;
$tabs.each(function (_index, tab) {
- var $tab = $(tab);
+ let $tab = $(tab);
if ($tab.hasClass(className.active)) {
- var
+ let
tabPath = $(this).data(metadata.tab),
$anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
;
@@ -776,7 +776,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -797,7 +797,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -825,7 +825,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -837,7 +837,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/src/definitions/modules/toast.js b/src/definitions/modules/toast.js
index 3d602d7609..b5e63cf446 100644
--- a/src/definitions/modules/toast.js
+++ b/src/definitions/modules/toast.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.toast = function (parameters) {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -33,7 +33,7 @@
returnedValue
;
$allModules.each(function () {
- var
+ let
settings = $.isPlainObject(parameters)
? $.extend(true, {}, $.fn.toast.settings, parameters)
: $.extend({}, $.fn.toast.settings),
@@ -159,11 +159,11 @@
},
toast: function () {
$toastBox = $('', { class: className.box });
- var iconClass = module.get.iconClass();
+ let iconClass = module.get.iconClass();
if (!isToastComponent) {
module.verbose('Creating toast');
$toast = $('', { role: 'alert' });
- var $content = $('', { class: className.content });
+ let $content = $('', { class: className.content });
if (iconClass !== '') {
$toast.append($('', { class: iconClass + ' ' + className.icon }));
}
@@ -175,7 +175,7 @@
}));
}
if (settings.title !== '') {
- var titleId = '_' + module.get.id() + 'title';
+ let titleId = '_' + module.get.id() + 'title';
$toast.attr('aria-labelledby', titleId);
$content.append($('', {
class: className.title,
@@ -183,7 +183,7 @@
html: module.helpers.escape(settings.title, settings.preserveHTML),
}));
}
- var descId = '_' + module.get.id() + 'desc';
+ let descId = '_' + module.get.id() + 'desc';
$toast.attr('aria-describedby', descId);
$content.append($('', {
class: className.message,
@@ -245,7 +245,7 @@
}
}
settings.actions.forEach(function (el) {
- var
+ let
icon = el[fields.icon]
? ''
@@ -262,7 +262,7 @@
class: className.button + ' ' + cls,
on: {
click: function () {
- var $button = $(this);
+ let $button = $(this);
if ($button.is(selector.approve) || $button.is(selector.deny) || click.call(element, $module) === false) {
return;
}
@@ -317,7 +317,7 @@
element = $toast[0];
}
if (settings.displayTime > 0) {
- var progressingClass = className.progressing + ' ' + (settings.pauseOnHover ? className.pausable : '');
+ let progressingClass = className.progressing + ' ' + (settings.pauseOnHover ? className.pausable : '');
if (settings.showProgress) {
$progress = $('', {
class: className.progress + ' ' + (settings.classProgress || settings.class),
@@ -569,7 +569,7 @@
helpers: {
toClass: function (selector) {
- var
+ let
classes = selector.trim().split(/\s+/),
result = ''
;
@@ -587,7 +587,7 @@
if (preserveHTML) {
return string;
}
- var
+ let
badChars = /["'<>`]/g,
shouldEscape = /["&'<>`]/,
escape = {
@@ -673,7 +673,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -694,7 +694,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -722,7 +722,7 @@
},
},
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -734,7 +734,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
@@ -924,7 +924,7 @@
$.extend($.easing, {
easeOutBounce: function (x) {
- var
+ let
n1 = 7.5625,
d1 = 2.75
;
diff --git a/src/definitions/modules/transition.js b/src/definitions/modules/transition.js
index 8e2e35593d..1a6feb998e 100644
--- a/src/definitions/modules/transition.js
+++ b/src/definitions/modules/transition.js
@@ -20,7 +20,7 @@
: globalThis;
$.fn.transition = function () {
- var
+ let
$allModules = $(this),
moduleSelector = $allModules.selector || '',
@@ -35,7 +35,7 @@
returnedValue
;
$allModules.each(function (index) {
- var
+ let
$module = $(this),
element = this,
@@ -110,7 +110,7 @@
forceRepaint: function () {
module.verbose('Forcing element repaint');
- var
+ let
$parentElement = $module.parent(),
$nextElement = $module.next()
;
@@ -123,13 +123,13 @@
repaint: function () {
module.verbose('Repainting element');
- var
+ let
fakeAssignment = element.offsetWidth
;
},
delay: function (interval) {
- var
+ let
direction = module.get.animationDirection(),
shouldReverse,
delay
@@ -229,7 +229,7 @@
force: {
visible: function () {
- var
+ let
style = $module.attr('style'),
userStyle = module.get.userStyle(style),
displayType = module.get.displayType(),
@@ -250,7 +250,7 @@
return true;
},
hidden: function () {
- var
+ let
style = $module.attr('style'),
currentDisplay = $module.css('display'),
emptyStyle = style === undefined || style === ''
@@ -270,7 +270,7 @@
has: {
direction: function (animation) {
- var
+ let
hasDirection = false
;
animation = animation || settings.animation;
@@ -286,7 +286,7 @@
return hasDirection;
},
inlineDisplay: function () {
- var
+ let
style = $module.attr('style') || ''
;
@@ -301,7 +301,7 @@
// determine exact animation
animation = animation || settings.animation;
- var animationClass = module.get.animationClass(animation);
+ let animationClass = module.get.animationClass(animation);
// save animation class in cache to restore class names
module.save.animation(animationClass);
@@ -405,7 +405,7 @@
restore: {
conditions: function () {
- var
+ let
animation = module.get.currentAnimation()
;
if (animation) {
@@ -420,7 +420,7 @@
add: {
failSafe: function () {
- var
+ let
duration = module.get.duration()
;
module.timer = setTimeout(function () {
@@ -523,7 +523,7 @@
});
},
animationClass: function (animation) {
- var
+ let
animationClass = animation || settings.animation,
directionClass = module.can.transition() && !module.has.direction()
? module.get.direction() + ' '
@@ -551,7 +551,7 @@
: className.outward;
},
animationDirection: function (animation) {
- var
+ let
direction
;
animation = animation || settings.animation;
@@ -593,7 +593,7 @@
return settings.displayType;
}
if (shouldDetermine && $module.data(metadata.displayType) === undefined) {
- var currentDisplay = $module.css('display');
+ let currentDisplay = $module.css('display');
if (currentDisplay === '' || currentDisplay === 'none') {
// create fake element to determine display state
module.can.transition(true);
@@ -613,7 +613,7 @@
return $.fn.transition.exists[animation];
},
animationStartEvent: function () {
- var
+ let
element = document.createElement('div'),
animations = {
animation: 'animationstart',
@@ -632,7 +632,7 @@
return false;
},
animationEndEvent: function () {
- var
+ let
element = document.createElement('div'),
animations = {
animation: 'animationend',
@@ -655,7 +655,7 @@
can: {
transition: function (forced) {
- var
+ let
animation = settings.animation,
transitionExists = module.get.transitionExists(animation),
displayType = module.get.displayType(false),
@@ -878,7 +878,7 @@
},
performance: {
log: function (message) {
- var
+ let
currentTime,
executionTime,
previousTime
@@ -899,7 +899,7 @@
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function () {
- var
+ let
title = settings.name + ':',
totalTime = 0
;
@@ -931,7 +931,7 @@
},
// modified for transition to return invoke success
invoke: function (query, passedArguments, context) {
- var
+ let
object = instance,
maxDepth,
found,
@@ -943,7 +943,7 @@
query = query.split(/[ .]/);
maxDepth = query.length - 1;
$.each(query, function (depth, value) {
- var camelCaseValue = depth !== maxDepth
+ let camelCaseValue = depth !== maxDepth
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
diff --git a/tasks/config/tasks.js b/tasks/config/tasks.js
index a7bcc70932..89f0721147 100644
--- a/tasks/config/tasks.js
+++ b/tasks/config/tasks.js
@@ -17,12 +17,9 @@ let overrideBrowserslist = hasBrowserslistConfig ? undefined : [
'android 4',
];
-// Node 12 does not support ??, so a little polyfill
-let nullish = (value, fallback) => (value !== undefined && value !== null ? value : fallback);
-
module.exports = {
- banner: nullish(config.banner, release.banner),
+ banner: config.banner ?? release.banner,
log: {
created: function (file) {
@@ -95,11 +92,11 @@ module.exports = {
/* Comment Banners */
header: {
- year: nullish(config.header.year, new Date().getFullYear()),
- title: nullish(config.header.title, release.title),
- version: nullish(config.header.version, release.version),
- repository: nullish(config.header.repository, release.repository),
- url: nullish(config.header.url, release.url),
+ year: config.header.year ?? new Date().getFullYear(),
+ title: config.header.title ?? release.title,
+ version: config.header.version ?? release.version,
+ repository: config.header.repository ?? release.repository,
+ url: config.header.url ?? release.url,
},
plumber: {