From 62d86c07f81dfae632742dbf62633e767bac8edd Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 29 Oct 2021 10:38:35 +0300 Subject: Rename variables --- js/src/util/sanitizer.js | 6 +++--- js/src/util/scrollbar.js | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'js/src/util') diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index 5a7a680355..1db61ae707 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -82,13 +82,13 @@ export const DefaultAllowlist = { ul: [] } -export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { +export function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { if (!unsafeHtml.length) { return unsafeHtml } - if (sanitizeFn && typeof sanitizeFn === 'function') { - return sanitizeFn(unsafeHtml) + if (sanitizeFunction && typeof sanitizeFunction === 'function') { + return sanitizeFunction(unsafeHtml) } const domParser = new window.DOMParser() diff --git a/js/src/util/scrollbar.js b/js/src/util/scrollbar.js index b81d4b2372..86a2bca01f 100644 --- a/js/src/util/scrollbar.js +++ b/js/src/util/scrollbar.js @@ -61,39 +61,39 @@ class ScrollBarHelper { this._element.style.overflow = 'hidden' } - _setElementAttributes(selector, styleProp, callback) { + _setElementAttributes(selector, styleProperty, callback) { const scrollbarWidth = this.getWidth() const manipulationCallBack = element => { if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { return } - this._saveInitialAttribute(element, styleProp) - const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProp) - element.style.setProperty(styleProp, `${callback(Number.parseFloat(calculatedValue))}px`) + this._saveInitialAttribute(element, styleProperty) + const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty) + element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`) } this._applyManipulationCallback(selector, manipulationCallBack) } - _saveInitialAttribute(element, styleProp) { - const actualValue = element.style.getPropertyValue(styleProp) + _saveInitialAttribute(element, styleProperty) { + const actualValue = element.style.getPropertyValue(styleProperty) if (actualValue) { - Manipulator.setDataAttribute(element, styleProp, actualValue) + Manipulator.setDataAttribute(element, styleProperty, actualValue) } } - _resetElementAttributes(selector, styleProp) { + _resetElementAttributes(selector, styleProperty) { const manipulationCallBack = element => { - const value = Manipulator.getDataAttribute(element, styleProp) + const value = Manipulator.getDataAttribute(element, styleProperty) // We only want to remove the property if the value is `null`; the value can also be zero if (value === null) { - element.style.removeProperty(styleProp) + element.style.removeProperty(styleProperty) return } - Manipulator.removeDataAttribute(element, styleProp) - element.style.setProperty(styleProp, value) + Manipulator.removeDataAttribute(element, styleProperty) + element.style.setProperty(styleProperty, value) } this._applyManipulationCallback(selector, manipulationCallBack) -- cgit v1.2.3