diff options
| author | Rohit Sharma <[email protected]> | 2021-03-30 11:27:05 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-30 08:57:05 +0300 |
| commit | 5cc53a0ef0718b43e376462f156d39bf5542fbf9 (patch) | |
| tree | 33c8c4d8643b15f8ad34ebb22c04814b1125f123 /js/src/util | |
| parent | 8c3e6ebc6e3e4fe6e0c31470195704872ec125f7 (diff) | |
| download | bootstrap-5cc53a0ef0718b43e376462f156d39bf5542fbf9.tar.xz bootstrap-5cc53a0ef0718b43e376462f156d39bf5542fbf9.zip | |
Use template literals instead of concatenation (#33497)
Diffstat (limited to 'js/src/util')
| -rw-r--r-- | js/src/util/index.js | 6 | ||||
| -rw-r--r-- | js/src/util/scrollbar.js | 2 |
2 files changed, 3 insertions, 5 deletions
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` }) } |
