isocket/macula-dropdown — pull request #3 by cbaclig (2014-03-26 04:35:00+00:00)
Title: Prevent opened dropdown from being immediately closed

Previously, [`return false` was removed from toggle](https://github.com/isocket/macula-dropdown/commit/c8a270dfbb2daf7b27cbbfdda2e180acc4c22313#diff-0298c45db16cd02d04e16b1182528febL45), which allows links to be followed when clicked in a dropdown. Now, however, dropdowns do not get opened in the first place.

When the dropdown toggle is clicked:

1. `toggle()` is called and the dropdown is opened
2. `closeAll()` is called when the event bubbles up to `document` and the same dropdown is immediately closed

This PR calls `event.stopPropagation()` at the end of `toggle` to prevent the event from bubbling all the way up to the document. It seems acceptable since we were already returning `false` from toggle. However, because we are stopping the event from bubbling up, this may limit clients in how they can use the dropdown.

I also updated `demo/index.html` with a dropdown that contains `a` tags in menu items for testing.