diff options
| author | Johann-S <[email protected]> | 2020-05-06 06:30:43 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-06 07:30:43 +0300 |
| commit | f91788548cad3a90e695641b319f49bce952e281 (patch) | |
| tree | 2aa883b59b2fb9719fd99563b6969a0cd605d2a8 | |
| parent | 122c99ebebc56a565705ed5a3d98dcfa22d40aa1 (diff) | |
| download | bootstrap-f91788548cad3a90e695641b319f49bce952e281.tar.xz bootstrap-f91788548cad3a90e695641b319f49bce952e281.zip | |
enforce element check on scrollspy target (#30747)
| -rw-r--r-- | js/src/scrollspy.js | 3 | ||||
| -rw-r--r-- | site/content/docs/4.3/components/scrollspy.md | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 96dd8303e..cb6c5c624 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -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) diff --git a/site/content/docs/4.3/components/scrollspy.md b/site/content/docs/4.3/components/scrollspy.md index 29b6468d0..318a76b35 100644 --- a/site/content/docs/4.3/components/scrollspy.md +++ b/site/content/docs/4.3/components/scrollspy.md @@ -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> |
