Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #10658
Closed
Open
Issue created Sep 16, 2013 by Administrator@rootContributor

jQuery Popover content loses bound events on second setContent call.

Created by: mauvm

When using a jQuery object as content ($el.popover( { content: $form } )), the form and form elements lose their bound events on second setContent call. When the popover is shown for second time, for example.

This happens because of a jQuery memory leak fix (explanation here, proof here). jQuery's html() method (used in Popover.prototype.setContent) internally uses this.empty().append( value ); and therefore removes the content before appending it again.

I suggest changing:

$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)

Into something like:

if (this.options.html) {
    $(content).appendTo($tip.find('.popover-content'))
} else {
    $tip.find('.popover-content').text(content)
}

Which fixes the issue. Note that even if content is a jQuery object, it is wrapped again, to support DOM nodes and HTML strings.

Assignee
Assign to
Time tracking