Changes between Version 4 and Version 5 of Ticket #10623, comment 4


Ignore:
Timestamp:
Sep 26, 2014, 4:50:33 AM (8 years ago)
Author:
sparkybg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10623, comment 4

    v4 v5  
    77Anyway it was just a proposition. I think it would be a good practice to give a way for widget instance to decide how to extend it's options out of the default behavior.
    88
    9 P.S.: Another possible way to do this is to make _createWidget function to use "this._extendOptions" instead of "$.widget.extend", This way, it will be possible to overload the default behavior in widget's definition. Another possible way is to make "_createWidget" to call "_this._extendOptions" which then will be able to decide if and when to use "$.widget.extend".
     9P.S.: Another possible way to do this is to make _createWidget function to use "this._extendOptions" instead of "$.widget.extend", This way, it will be possible to overload the default behavior in widget's definition. Another possible way is to make "_createWidget" to call "this._extendOptions", defined in Widget prototype, which then, if overloaded, will be able to decide if and when to use "$.widget.extend".
    1010
    1111As far as I can see, up to version 1.8, the options are copied with "$.extend(true,...)" instead which creates copies of Arrays also. Then, in 1.9 and up to 1.11 it uses "$.widget.extend" which does not copy Arrays. This creates incompatibility issues. All this can be avoided in future versions just by providing a documented way for a widget to decide what to do with it's options on creation.