Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdown #39182

Open
3 tasks done
DJafari opened this issue Sep 14, 2023 · 4 comments
Open
3 tasks done
Labels

Comments

@DJafari
Copy link

DJafari commented Sep 14, 2023

Prerequisites

Describe the issue

i want show tooltip on dropdown toggle button

i thinks it's bug, why i can't use two different component for one element ?

Reduced test cases

https://codepen.io/Davood-Jafari/pen/yLGXWXX

const el = document.querySelector('#myBtn');
new Dropdown(el);
new Tooltip(el);
<div class="dropdown">
  <button
    id="myBtn"
    class="btn btn-secondary dropdown-toggle"
    data-bs-title="Default tooltip"
    type="button"
    data-bs-toggle="dropdown"
    aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu">
    <li>
      <a class="dropdown-item" href="#"> Action </a>
    </li>
    <li>
      <a class="dropdown-item" href="#"> Another action </a>
    </li>
    <li>
      <a class="dropdown-item" href="#"> Something else here </a>
    </li>
  </ul>
</div>

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

5.2.3

@DJafari DJafari changed the title Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdownProvide a general summary of the issue Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdown Sep 14, 2023
@github-actions

This comment was marked as resolved.

@DJafari

This comment was marked as resolved.

@ajiho
Copy link

ajiho commented Jun 9, 2024

是的,为什么不能在同一个元素上绑定多个组件?

data.js:26 Bootstrap doesn't allow more than one instance per element. Bound instance: bs.tooltip.

@cvirtucio
Copy link

I tracked this down to an earlier issue and a prior conversation. This seems intended to maintain (then existing) behavior where only one key could be assigned to an element. The error message seems to be more like a warning that was added as part of a guard clause for the new data structure. I'm not a javascript developer by any means but my understanding is that the error is more like a warning that can be mostly ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants