diff options
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/cbi.js')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/cbi.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 3ace96f322..d9b9baf7be 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -1506,7 +1506,18 @@ function E() if (attr) for (var key in attr) if (attr.hasOwnProperty(key) && attr[key] !== null && attr[key] !== undefined) - elem.setAttribute(key, attr[key]); + switch (typeof(attr[key])) { + case 'function': + elem.addEventListener(key, attr[key]); + break; + + case 'object': + elem.setAttribute(key, JSON.stringify(attr[key])); + break; + + default: + elem.setAttribute(key, attr[key]); + } if (typeof(data) === 'function') data = data(elem); |