mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-22 13:13:03 +02:00
enforce element check on scrollspy target
This commit is contained in:
@@ -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)
|
||||
|
@@ -127,7 +127,7 @@ $(function () {
|
||||
.show()
|
||||
.find('#scrollspy-example')
|
||||
.bootstrapScrollspy({
|
||||
target: document.getElementById('#ss-target')
|
||||
target: document.getElementById('ss-target')
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user