bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

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

Open DJafari opened this issue 2 years ago • 4 comments

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 avatar Sep 14 '23 12:09 DJafari

Hello @DJafari. Bug reports must include a live demo of the issue. Per our contributing guidelines, please create a reduced test case on CodePen or StackBlitz and report back with your link, Bootstrap version, and specific browser and Operating System details.

github-actions[bot] avatar Sep 14 '23 12:09 github-actions[bot]

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

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 avatar Sep 14 '23 12:09 DJafari

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

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

ajiho avatar Jun 09 '24 07:06 ajiho

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.

cvirtucio avatar Dec 10 '24 14:12 cvirtucio