Upgrading code from jQuery UI 1.7 to 1.8 failing

Upgrading code from jQuery UI 1.7 to 1.8 failing

I have some old jquery (UI) code that I want to upgrade to todays standards. Since my code was written for jQuery UI 1.7.3 I've decided to upgrade the code release by release. A release list is found here: https://jqueryui.com/upgrade-guide/

So if I open 1.8 Upgrade Guide I can see what was changed. So far so good. As far as I can see, the following changes apply to my code:

  • Renamed _init() to _create()
  • Renamed _setData() to _setOption()
  • Removed _getData() since it should never be overridden
  • $.widget() now accepts a base widget to extend as the second parameter; defaults to $.Widget

Unfortunately I am not sure what to do with _getData(). Must I replace this with _Option or _getOption?. This is not clear in the guide.

Nevertheless, changing my code results in a nonworking application. I hope someone can help me out.

This is (partly) my old code:

_init: function () { var index = this.options.index; var num_ranks = this._RANKS.length; var suit = parseInt(index/num_ranks); this._setData('suit', suit); this._setData('rank', index - (suit * num_ranks)); this.element.addClass('container') .append('<div class="downturned">'); }, _suit: function () { return this._getData('suit'); }, _rank: function () { return this._getData('rank'); },

And further in the code:

 $.widget('ui.card', Card); //Create the widget $ui.card.getter = "is_downtunred";

The above I've changed (using the guide) to:

_create: function () { var index = this.options.index; var num_ranks = this._RANKS.length; var suit = parseInt(index/num_ranks); this._setOption('suit', suit); this._setOption('rank', index - (suit * num_ranks)); this.element.addClass('container') .append('<div class="downturned">'); }, _suit: function () { return this._getOption('suit'); }, _rank: function () { return this._getOption('rank'); },

And further in the code (did not change anything here):

 $.widget('ui.card', Card); //Create the widget $ui.card.getter = "is_downtunred";

But this brakes the application. Anyone knows why? What am I missing?

Thanks for the help