Dropdown.prototype.toggle() should ignore defaultPrevented click events
Created by: jasonlo87
Ran into a simple looking issue w/ dropdown.js:
- Catch some event before BS and clear the .open class off a dropdown.
- PreventDefault on the event in the same handler.
- Dropdown.prototype.toggle erroneously tries to check for isDefaultPrevented() AFTER it's blasted away the original event and replaced it with a brand new one.
Result: Bootstrap re-toggles my dropdown back open.
Expected: Bootstrap respects my preventDefault and doesn't toggle the dropdown back open.
Here's a JSFiddle displaying the issue. It appears that the isDefaultPrevented() check should just be moved up a few lines (it also appears to occur like this in clearMenus() and maybe a few other methods in there): https://jsfiddle.net/9che8vz3/5/