0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-19 16:54:24 +01:00

enforce element check on scrollspy target

This commit is contained in:
Johann-S 2020-05-05 21:42:58 +02:00 committed by XhmikosR
parent 5f267b1854
commit 22f75ca2e3
3 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class ScrollSpy {
...typeof config === 'object' && config ? config : {}
}
if (typeof config.target !== 'string') {
if (typeof config.target !== 'string' && Util.isElement(config.target)) {
let id = $(config.target).attr('id')
if (!id) {
id = Util.getUID(NAME)

View File

@ -127,7 +127,7 @@ $(function () {
.show()
.find('#scrollspy-example')
.bootstrapScrollspy({
target: document.getElementById('#ss-target')
target: document.getElementById('ss-target')
})
$scrollspy.one('scroll', function () {

View File

@ -314,7 +314,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>