From 8ff7edaab4f55b6612df3fe670aa9b9ac0984eae Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 19 Oct 2016 08:27:41 -0700 Subject: version bump to alpha 5 --- js/src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/util.js') diff --git a/js/src/util.js b/js/src/util.js index d117dfcd5..f9e7f77fa 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): util.js + * Bootstrap (v4.0.0-alpha.5): util.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -- cgit v1.2.3 From bf439363775c98d900f7ef3d6d0297fa8887ef58 Mon Sep 17 00:00:00 2001 From: Ilias Date: Sun, 30 Oct 2016 23:47:14 +0200 Subject: Fix #17964 (#17997) * Fix #17964 Some browsers are lazy when updating dom elements after transition effects. This can be fixed by reading element properties such as offsetHeight or offsetWidth. However, creating a function using the Function constructor just to access such element, results in a violation of Content Security Policy (where applied), which in turn crashes the application. This fix actually reverts to the way this was handled in v3 and should work as intended. --- js/src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/util.js') diff --git a/js/src/util.js b/js/src/util.js index f9e7f77fa..5ddbbbf13 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -121,7 +121,7 @@ const Util = (($) => { }, reflow(element) { - new Function('bs', 'return bs')(element.offsetHeight) + return element.offsetHeight }, triggerTransitionEnd(element) { -- cgit v1.2.3 From c2616fb74e6bdc0cd46a5678a2c5cffcbe422106 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Tue, 22 Nov 2016 01:36:00 +1100 Subject: Make JS compliant with the new ESLint rules. --- js/src/util.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'js/src/util.js') diff --git a/js/src/util.js b/js/src/util.js index 5ddbbbf13..06424fbfe 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -27,7 +27,7 @@ const Util = (($) => { // shoutout AngusCroll (https://goo.gl/pxwQGp) function toType(obj) { - return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase() + return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase() } function isElement(obj) { @@ -52,11 +52,13 @@ const Util = (($) => { return false } - let el = document.createElement('bootstrap') + const el = document.createElement('bootstrap') - for (let name in TransitionEndEvent) { + for (const name in TransitionEndEvent) { if (el.style[name] !== undefined) { - return { end: TransitionEndEvent[name] } + return { + end: TransitionEndEvent[name] + } } } @@ -96,15 +98,14 @@ const Util = (($) => { * -------------------------------------------------------------------------- */ - let Util = { + const Util = { TRANSITION_END: 'bsTransitionEnd', getUID(prefix) { do { - /* eslint-disable no-bitwise */ + // eslint-disable-next-line no-bitwise prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here - /* eslint-enable no-bitwise */ } while (document.getElementById(prefix)) return prefix }, @@ -133,17 +134,12 @@ const Util = (($) => { }, typeCheckConfig(componentName, config, configTypes) { - for (let property in configTypes) { + for (const property in configTypes) { if (configTypes.hasOwnProperty(property)) { - let expectedTypes = configTypes[property] - let value = config[property] - let valueType - - if (value && isElement(value)) { - valueType = 'element' - } else { - valueType = toType(value) - } + const expectedTypes = configTypes[property] + const value = config[property] + const valueType = value && isElement(value) ? + 'element' : toType(value) if (!new RegExp(expectedTypes).test(valueType)) { throw new Error( -- cgit v1.2.3