forked from 0x2620/pandora
create UI tree if setting a nested propery if its undefined
This commit is contained in:
parent
bf1dde53d6
commit
73c3a134a2
1 changed files with 6 additions and 0 deletions
|
@ -218,8 +218,14 @@ pandora.UI = (function() {
|
||||||
var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) {
|
var keys = key.replace(/\\\./g, '\n').split('.').map(function(key) {
|
||||||
return key.replace(/\n/g, '.')
|
return key.replace(/\n/g, '.')
|
||||||
}),
|
}),
|
||||||
|
part,
|
||||||
ui = pandora.user.ui;
|
ui = pandora.user.ui;
|
||||||
while (keys.length > 1) {
|
while (keys.length > 1) {
|
||||||
|
part = part ? part + '.' + keys[0] : keys[0];
|
||||||
|
if (Ox.isUndefined(ui[keys[0]])) {
|
||||||
|
ui[keys[0]] = {};
|
||||||
|
set[part] = {};
|
||||||
|
}
|
||||||
ui = ui[keys.shift()];
|
ui = ui[keys.shift()];
|
||||||
}
|
}
|
||||||
if (!Ox.isEqual(ui[keys[0]], val)) {
|
if (!Ox.isEqual(ui[keys[0]], val)) {
|
||||||
|
|
Loading…
Reference in a new issue