aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRohit Sharma <[email protected]>2021-03-30 11:27:05 +0530
committerGitHub <[email protected]>2021-03-30 08:57:05 +0300
commit5cc53a0ef0718b43e376462f156d39bf5542fbf9 (patch)
tree33c8c4d8643b15f8ad34ebb22c04814b1125f123 /js
parent8c3e6ebc6e3e4fe6e0c31470195704872ec125f7 (diff)
downloadbootstrap-5cc53a0ef0718b43e376462f156d39bf5542fbf9.tar.xz
bootstrap-5cc53a0ef0718b43e376462f156d39bf5542fbf9.zip
Use template literals instead of concatenation (#33497)
Diffstat (limited to 'js')
-rw-r--r--js/src/modal.js2
-rw-r--r--js/src/util/index.js6
-rw-r--r--js/src/util/scrollbar.js2
3 files changed, 4 insertions, 6 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index 2966f03fb..4ce910dc6 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -474,7 +474,7 @@ class Modal extends BaseComponent {
const actualValue = element.style[styleProp]
const calculatedValue = window.getComputedStyle(element)[styleProp]
Manipulator.setDataAttribute(element, styleProp, actualValue)
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`
})
}
diff --git a/js/src/util/index.js b/js/src/util/index.js
index a7578b180..cc35d8a37 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -48,7 +48,7 @@ const getSelector = element => {
// Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
- hrefAttr = '#' + hrefAttr.split('#')[1]
+ hrefAttr = `#${hrefAttr.split('#')[1]}`
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null
@@ -128,9 +128,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(
- `${componentName.toUpperCase()}: ` +
- `Option "${property}" provided type "${valueType}" ` +
- `but expected type "${expectedTypes}".`
+ `${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
)
}
})
diff --git a/js/src/util/scrollbar.js b/js/src/util/scrollbar.js
index 3e619ef51..e63a66bf2 100644
--- a/js/src/util/scrollbar.js
+++ b/js/src/util/scrollbar.js
@@ -35,7 +35,7 @@ const _setElementAttributes = (selector, styleProp, callback) => {
const actualValue = element.style[styleProp]
const calculatedValue = window.getComputedStyle(element)[styleProp]
Manipulator.setDataAttribute(element, styleProp, actualValue)
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`
})
}