mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
enforce element check on scrollspy target (#30747)
This commit is contained in:
parent
122c99ebeb
commit
f91788548c
2 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Add table
Reference in a new issue