]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Use template literals instead of concatenation (#33497)
authorRohit Sharma <rohit2sharma95@gmail.com>
Tue, 30 Mar 2021 05:57:05 +0000 (11:27 +0530)
committerGitHub <noreply@github.com>
Tue, 30 Mar 2021 05:57:05 +0000 (08:57 +0300)
js/src/modal.js
js/src/util/index.js
js/src/util/scrollbar.js

index 2966f03fb5d165fb3959fae6112c61b1f071da59..4ce910dc6a5b859d9f61fbf1f3b93bc478f971c2 100644 (file)
@@ -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`
       })
   }
 
index a7578b18004abab529ce23258156812c84d97df4..cc35d8a37c4c912fd75b042fb72c1f54dd7a7030 100644 (file)
@@ -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}".`
       )
     }
   })
index 3e619ef51e4334351e16c504d29843c0dd8471d8..e63a66bf218b21318c5dfcadfee53561fd7453e7 100644 (file)
@@ -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`
     })
 }