diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-04-13 22:46:05 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-04-13 22:46:05 +0200 |
commit | c67d90dd163b16f9cc603c898672264ffb17ebf7 (patch) | |
tree | 621d705db7426d19cb46505327ec4f4f38cd52f9 | |
parent | e93a839d17e933f970baf9b2481817d0598e1746 (diff) | |
download | luci2-ui-c67d90dd163b16f9cc603c898672264ffb17ebf7.tar.gz |
luci2: support object comparisations in L.cbi.AbstractValue.changed()
-rw-r--r-- | luci2/htdocs/luci2/luci2.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js index e47f5bd..d275d1b 100644 --- a/luci2/htdocs/luci2/luci2.js +++ b/luci2/htdocs/luci2/luci2.js @@ -5099,7 +5099,7 @@ function LuCI2() if (typeof(a) != typeof(b)) return true; - if (typeof(a) == 'object') + if ($.isArray(a)) { if (a.length != b.length) return true; @@ -5110,6 +5110,18 @@ function LuCI2() return false; } + else if ($.isPlainObject(a)) + { + for (var k in a) + if (!(k in b)) + return true; + + for (var k in b) + if (!(k in a) || a[k] !== b[k]) + return true; + + return false; + } return (a != b); }, |