1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-09 07:06:36 +02: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
2 changed files with 3 additions and 2 deletions

View File

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

View File

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