diff --git a/build/js/ox.js b/build/js/ox.js index 5320c70d..9bde4049 100644 --- a/build/js/ox.js +++ b/build/js/ox.js @@ -159,27 +159,33 @@ Ox.each = function(obj, fn) { return obj; }; -Ox.equals = function() { // unused +Ox.equals = function(obj0, obj1) { /* ... core? type? */ var ret = false; - if (obj0.length == obj1.length) { - Ox.each(obj0, function(k, v) { - if (Ox.isObject(v)) { - - } else { - - } - return ret; - }); + if (obj0 === obj1) { + ret = true; + } else if (typeof(obj0) == typeof(obj1)) { + if (obj0 == obj1) { + ret = true; + } else if (Ox.isArray(obj0) && obj0.length == obj1.length) { + Ox.each(obj0, function(i, v) { + ret = v == obj1[i]; + return ret; + }); + } else if (Ox.isObject(obj0)) { + ret = Ox.equals(Ox.keys(obj0), Ox.keys(obj1)) && + Ox.equals(Ox.values(obj0), Ox.values(obj1)); + } } + Ox.print('Ox.equals', obj0, obj1, ret) return ret; } Ox.every = function(obj, fn) { /* - Ox.every() forks for arrays, objects and strings, unlike [].every() + Ox.every() works for arrays, objects and strings, unlike [].every() >>> Ox.every([0, 1, 2], function(v, i) { return i == v; }) true >>> Ox.every({a: 1, b: 2, c: 3}, function(v) { return v == 1; }) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index a584a585..351619a6 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -1051,18 +1051,7 @@ requires self.options = $.extend(self.options || self.defaults, args); $.each(args, function(key, value) { // key == 'id' && id && Ox.Event.changeId(id, value); - value !== oldOptions[key] && self.onChange(key, value); - /* - fixme: why does this not work? - Ox.print('options', options, key, value) - //Ox.print(!options, !options || !options[key], !options || !options[key] || options[key] !== value) - if (!options || !options[key] || options[key] !== value) { - Ox.print('onChange...') - self.onChange(key, value); - } else { - Ox.print('NO CHANGE'); - } - */ + /*!Ox.equals(value, oldOptions[key]) &&*/ self.onChange(key, value); }); ret = that; } @@ -9801,7 +9790,9 @@ requires } self.onChange = function(key, value) { + Ox.print('onChange:', key, value) if (key == 'points') { + Ox.print('key', key, 'value', value) setMarkerPoint(0); setMarkerPoint(1); } else if (key == 'position') { @@ -10182,6 +10173,7 @@ requires }); }); $.each(self.$timeline, function(i, v) { + Ox.print('points:', self.options.points) v.options({ points: self.options.points });