fyneworks / star-rating

jQuery Star Rating Plugin
MIT License
29 stars 17 forks source link

Change to use andSelf to ensure backward compatibility with jquery < 1.9 #3

Closed kabudu closed 11 years ago

kabudu commented 11 years ago

For those using jquery < 1.9 such as symfony 2 installs using the mopa bootstrap bundle, the function addBack does not exist rendering the plugin un-useable. I've made a change to use the function andSelf which makes the plugin backward compatible and forward compatible as andSelf is an alias to addBack in jquery >= 1.9.

digggggggggg commented 11 years ago

andSelf has been depricated and will be eventually dropped. It is more important to ensure the plugin's compatibility with future versions of jQuery than with past versions (specially beyond 1.8).

If anything we'll need line 239 to be...

this.prevAll()[$.fn.addBack?'addBack':'andSelf']().filter('.rater-'+ control.serial).addClass('star-rating-hover');

...although I am in favour of pushing everyone up to jQuery 1.9. This isn't the only plugin that has been adapted, I feel this is what's best for the community.

What are the chances of symfony being updated any time soon?

Perhaps you could fork the plugin and use the patch I suggested above (so this doesn't have to go in the main dev branch)?

kabudu commented 11 years ago

Your argument makes a lot of sense, however I'm unsure when the mopa bootstrap bundle will have its jquery version updated, so in order to use your library now I believe your solution is better than mine. I've already forked your plugin and using it with the changes I made, but I'll update my change to use yours instead.