Created by: yyjiugui
Description
Motivation & Context
// make it clear we only want one instance per element
// can be removed later when multiple key/instances are fine to be used
if (!instanceMap.has(key) && instanceMap.size !== 0) {
// eslint-disable-next-line no-console
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)
return
}
I don't understand why we should reverse. I tried to write code like this in the script.
var spy1 = new bootstrap.ScrollSpy(document.body, {
target: '#navbar-example1'
})
var spy2 = new bootstrap.ScrollSpy(document.body, {
target: '#navbar-example2'
})
The result does not meet the expectation that one element has only one instance. Thanks for answering my question.
Type of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Refactoring (non-breaking change) -
Breaking change (fix or feature that would change existing functionality)
Live previews
- https://deploy-preview-{your pr number}--twbs-bootstrap.netlify.app/