diff --git a/js/src/collapse.js b/js/src/collapse.js index c3b3599ecc..e22cf0b7ab 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -331,7 +331,7 @@ const Collapse = (($) => { const _config = { ...Default, ...$this.data(), - ...typeof config === 'object' && config + ...typeof config === 'object' && config ? config : {} } if (!data && _config.toggle && /show|hide/.test(config)) { diff --git a/js/src/modal.js b/js/src/modal.js index 1df4152666..e3de68b8fe 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -500,7 +500,7 @@ const Modal = (($) => { const _config = { ...Default, ...$(this).data(), - ...typeof config === 'object' && config + ...typeof config === 'object' && config ? config : {} } if (!data) { diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 1c46940f53..d8cf69473b 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -165,7 +165,7 @@ const ScrollSpy = (($) => { _getConfig(config) { config = { ...Default, - ...config + ...typeof config === 'object' && config ? config : {} } if (typeof config.target !== 'string') { diff --git a/js/src/tooltip.js b/js/src/tooltip.js index f751ee3c94..59c26897c9 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -611,7 +611,7 @@ const Tooltip = (($) => { config = { ...this.constructor.Default, ...$(this.element).data(), - ...config + ...typeof config === 'object' && config ? config : {} } if (typeof config.delay === 'number') { diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 726655e9cc..f87c65bea0 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -544,6 +544,41 @@ $(function () { $dropdown.trigger('click') }) + QUnit.test('should skip disabled element when using keyboard navigation', function (assert) { + assert.expect(3) + var done = assert.async() + var dropdownHTML = '