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
  • #12379
Closed
Open
Issue created Jan 25, 2014 by Administrator@rootContributor

closed.bs.alert fires before remove()

Created by: EnsignR

As mentioned in #10199 the event closed.bs.alert fires before elements are removed from the DOM.

I have made a jsfiddle to illustrate this here http://jsfiddle.net/ensignr/NFrFc/

  1. 3x div.alert are created in a div#cont
  2. event listener for 'close.bs.alert' and 'closed.bs.alert' attached to div.alert's
  3. the event listener counts the number of elements in #cont and reports them
  4. it's expected for the coupled close/closed events the count should be one less for closed. This is not the case.
  5. the count can also be checked by clicking the div.out, which shows the count is actually reduced if you click after closed event fires.

I believe the problem lies in Alert.removeElement() in /js/alert.js:45 Here remove() is called after the trigger() in the chain. The following change, where I detach() first, seem to fix things.

function removeElement() {
      $parent.detach().trigger('closed.bs.alert')
    }

I managed to quickly patch the 3.0.3 minified version bootrap.min.js which seems to work. You can see it here http://jsfiddle.net/ensignr/6VjPP/ (for as long as I keep the modified code hosted)

I've tried both the patched and non patched jsfiddles (as well as the project that lead me to discover this) in both Chrome 32.0.1700.76 and IE11 on Win7.

[Apols if I've missed/messed up the markup or something else, but I've had to join all the things to submit this bug report. It's been quite an effort :) ]

Assignee
Assign to
Time tracking