0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-30 22:52:24 +01:00

enforce element check on scrollspy target (#30747)

This commit is contained in:
Johann-S 2020-05-06 06:30:43 +02:00 committed by GitHub
parent 122c99ebeb
commit f91788548c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import {
getjQuery,
getSelectorFromElement,
getUID,
isElement,
typeCheckConfig
} from './util/index'
import Data from './dom/data'
@ -168,7 +169,7 @@ class ScrollSpy {
...typeof config === 'object' && config ? config : {}
}
if (typeof config.target !== 'string') {
if (typeof config.target !== 'string' && isElement(config.target)) {
let { id } = config.target
if (!id) {
id = getUID(NAME)

View File

@ -324,7 +324,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
</tr>
<tr>
<td>target</td>
<td>string</td>
<td>string | jQuery object | DOM element</td>
<td></td>
<td>Specifies element to apply Scrollspy plugin.</td>
</tr>