rvera / image-picker

Image Picker is a simple jQuery plugin that transforms a select element into a more user friendly graphical interface.
http://rvera.github.com/image-picker
Other
906 stars 216 forks source link

Definining this in handlers #9

Closed floo51 closed 11 years ago

floo51 commented 11 years ago

Call of the handlers (clicked, selected...) through call function passing the initial selector as this.

Makes it easier to do things like :

 clicked : function(){
      console.log($(this).val());
 }
chiqui3d commented 11 years ago

Thanks!!!!

rvera commented 11 years ago

I've been thinking in this feature for a while.

I was not sure what should be returned on each callback function or what the context of each callback should be. So for a long time callbacks where implemented but not documented. As of now I'm still unsure what's the best option for this. What do you think?

As for this pull request, I can't merge it since you modified the .js directly and the source code is in coffeescript.

floo51 commented 11 years ago

From what i've seen in most jquery features / plugins, "this", in handlers, is always refering to the initial selector you applied the function to.

About the pull request, didn't even noticed it was in CS, my bad ! Gonna take a look at the CS source and modify it accordingly when i get some free time.

rvera commented 11 years ago

I can probably fix it using your commit as a blueprint if you are busy.

rvera commented 11 years ago

Sorry for the late pull, everything has been merged into master now. Thanks a lot for this.