diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 4a28264b3a99..27b998c6201a 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -54,7 +54,7 @@ }, { "path": "./dist/js/bootstrap.min.js", - "maxSize": "16.25 kB" + "maxSize": "16.5 kB" } ], "ci": { diff --git a/js/src/util/index.js b/js/src/util/index.js index e268b07287a0..e9950c9e387a 100644 --- a/js/src/util/index.js +++ b/js/src/util/index.js @@ -166,7 +166,7 @@ const isDisabled = element => { return element.disabled } - return element.getAttribute('disabled') !== 'false' + return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false' } const findShadowRoot = element => { diff --git a/js/tests/unit/util/index.spec.js b/js/tests/unit/util/index.spec.js index 24921d730e7b..41c1ce2b80b4 100644 --- a/js/tests/unit/util/index.spec.js +++ b/js/tests/unit/util/index.spec.js @@ -347,16 +347,19 @@ describe('Util', () => { expect(Util.isDisabled(div2)).toEqual(true) }) - it('should return false if the element has disabled attribute with "false" value', () => { + it('should return false if the element has disabled attribute with "false" value, or doesn\'t have attribute', () => { fixtureEl.innerHTML = [ '
', '
', + '
', '
' ].join('') const div = fixtureEl.querySelector('#element') + const div1 = fixtureEl.querySelector('#element1') expect(Util.isDisabled(div)).toEqual(false) + expect(Util.isDisabled(div1)).toEqual(false) }) it('should return false if the element is not disabled ', () => {