Fix of jQuery.durationPicker

I have noticed (shamefully late), that the demo for durationPicker is not working in Chrome and IE. It works only in Firefox.  I will fix it in 24hrs (it will take longer than that), when I will have time to do it, and investigate what caused it.

Link to original article on durationPicker.

Little jQuery.extend gotcha

jQuery.extend() is a very powerful function for merging two objects or for extending jQuery with custom plugins.

There is but one little gotcha to think about: as in most function calls the order of parameters matters 🙂

Following two fragments of code yields different objects

var a = {
  aa : '1'
  , bb : '2'
  , cc : '3'

var b = {
  aa : '11'
  , bb : '22'
  , dd: 3

var result_a = $.extend({}, true, a, b);
var result_b = $.extend({}, true, b, a);

The result will be this:

Notice that I use $.extend({}, true, a, b) instead of $.extend(a, b). The first parameter (which is optional) is the target which should receive merged properties. If none is given than the first object is extended automatically.