In this commit I made it so that we store the direct object that the user gives us instead of plucking values from it.
I also fixed a naming inconsistency between mention.name and mention.value.
Store raw mention object in mentionsCollection
I like the idea of storing the mentions object internally instead of using the DOM as a temp place to store the necessary values.
What I don't like is to use jQuery.data to store the values. If you look at the implementation it isnt using any methods that is very specific to jQuery, but rather addClass, remove, wrap and find, which is quite common on other frameworks (like Zepto). This would allow a easy port to other frameworks without too much of a headache.
It's only the bottom part of the plugin, which extends the jquery object with mentionsInput, that is closely coupled to jQuery. I would prefer if we could keep it that way going forward.
What's your perspective?
The reason I had used $.fn.data was because it was the simplest thing to do at the time.
I'm completely fine with decoupling it from jQuery. It's probably the best way to go.
I'm going to close this for now and be back with a pull request sometime soon.