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

Fix popover when using append #13165

Merged
merged 2 commits into from
Mar 25, 2014
Merged

Fix popover when using append #13165

merged 2 commits into from
Mar 25, 2014

Conversation

stefanneculai
Copy link
Contributor

Using a HTML object for content is currently adding the same content several times in popover. The old content should be removed before adding the new one.

@cvrebert
Copy link
Collaborator

Presumably fixes #12571.

@cvrebert cvrebert added the js label Mar 24, 2014
@cvrebert
Copy link
Collaborator

Approximate duplicate of #12604.

@stefanneculai
Copy link
Contributor Author

Yes, it is like #12604 only that it does empty all the time. It looks like @fat suggested to do empty all the time on a comment.

@stefanneculai
Copy link
Contributor Author

Test added too.

@fat
Copy link
Member

fat commented Mar 25, 2014

swoon - lgtm thanks !!

fat added a commit that referenced this pull request Mar 25, 2014
Fix popover when using append
@fat fat merged commit b3421cf into twbs:master Mar 25, 2014
@mdo mdo mentioned this pull request Mar 25, 2014
@programcsharp
Copy link
Contributor

This is bad because it blows up the content. If you're planning on using it later or swapping it around, you can't. jQuery won't let you reattach the content or rewire events to it. Instead, should do .children().detach(), like:

    $tip.find('.popover-content').children().detach()
    $tip.find('.popover-content')[ // we use append for html objects to maintain js events
      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
    ](content)

@cvrebert
Copy link
Collaborator

@programcsharp File a new bug.

@twbs twbs locked and limited conversation to collaborators Jul 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants