This repository was archived by the owner on Apr 22, 2018. It is now read-only.
Trigger events on show, click, and close #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit triggers three custom events on the original target element that is passed into the show function:
It allows you to respond to all three events with any particular behavior. Also, in the case of the click, the item is passed with the event as detail data, so you can do something with it and pass in custom information. It also passes in the mouse event that triggered the click, and the index of the item that was clicked:
It still handles passing in a
fnwith the link, so it won't break any existing setup. But, because fn won't be present with events, it doesn't keep from rendering a link if fn is missing.The event creation is IE11 and newer. Other browsers should be ok. If you want older compatibility we can modify the trigger method with a few lines.
Last of all, I added a replace step to your gulp process so the "\n\t " strings are removed from the minified result. It's just a byproduct of your multi-line string templates. And it saves a few bits.
If you're accept this, I'll do another pull with documentation.