diff options
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/carousel.js | 2 | ||||
| -rw-r--r-- | js/src/collapse.js | 2 | ||||
| -rw-r--r-- | js/src/dropdown.js | 4 | ||||
| -rw-r--r-- | js/src/modal.js | 2 | ||||
| -rw-r--r-- | js/src/popover.js | 2 | ||||
| -rw-r--r-- | js/src/scrollspy.js | 5 | ||||
| -rw-r--r-- | js/src/tab.js | 2 | ||||
| -rw-r--r-- | js/src/tooltip.js | 2 | ||||
| -rw-r--r-- | js/src/util.js | 6 |
9 files changed, 14 insertions, 13 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index 6bcf470f9..873660519 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -443,7 +443,7 @@ const Carousel = (($) => { if (typeof config === 'number') { data.to(config) } else if (typeof action === 'string') { - if (data[action] === undefined) { + if (typeof data[action] === 'undefined') { throw new Error(`No method named "${action}"`) } data[action]() diff --git a/js/src/collapse.js b/js/src/collapse.js index 2f00b98cb..718630bd3 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -343,7 +343,7 @@ const Collapse = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 5e792a527..e1c48ac6e 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -204,7 +204,7 @@ const Dropdown = (($) => { _getConfig(config) { const elementData = $(this._element).data() - if (elementData.placement !== undefined) { + if (typeof elementData.placement !== 'undefined') { elementData.placement = AttachmentMap[elementData.placement.toUpperCase()] } @@ -287,7 +287,7 @@ const Dropdown = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/modal.js b/js/src/modal.js index 9f17fafc8..d21a137fb 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -507,7 +507,7 @@ const Modal = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config](relatedTarget) diff --git a/js/src/popover.js b/js/src/popover.js index 0e8953f77..7639e3e20 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -162,7 +162,7 @@ const Popover = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index b70b7e477..588f65298 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -231,7 +231,7 @@ const ScrollSpy = (($) => { for (let i = this._offsets.length; i--;) { const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] - && (this._offsets[i + 1] === undefined || + && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]) if (isActiveTarget) { @@ -246,6 +246,7 @@ const ScrollSpy = (($) => { this._clear() let queries = this._selector.split(',') + // eslint-disable-next-line arrow-body-style queries = queries.map((selector) => { return `${selector}[data-target="${target}"],` + `${selector}[href="${target}"]` @@ -287,7 +288,7 @@ const ScrollSpy = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/tab.js b/js/src/tab.js index 4c3091495..c32cd3776 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -238,7 +238,7 @@ const Tab = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 2060cebbb..721f04481 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -698,7 +698,7 @@ const Tooltip = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() diff --git a/js/src/util.js b/js/src/util.js index 387c7d2ed..69fb8283c 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -42,7 +42,7 @@ const Util = (($) => { if ($(event.target).is(this)) { return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params } - return undefined + return undefined // eslint-disable-line no-undefined } } } @@ -55,7 +55,7 @@ const Util = (($) => { const el = document.createElement('bootstrap') for (const name in TransitionEndEvent) { - if (el.style[name] !== undefined) { + if (typeof el.style[name] !== 'undefined') { return { end: TransitionEndEvent[name] } @@ -138,7 +138,7 @@ const Util = (($) => { typeCheckConfig(componentName, config, configTypes) { for (const property in configTypes) { - if (configTypes.hasOwnProperty(property)) { + if (Object.prototype.hasOwnProperty.call(configTypes, property)) { const expectedTypes = configTypes[property] const value = config[property] const valueType = value && isElement(value) ? |
