Updated the forms.update() function to be generic

pull/272/head
Rob Moran 2016-03-01 10:51:37 +00:00 zatwierdzone przez nightwing
rodzic 0dafa98032
commit 784b3edaec
1 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -481,14 +481,21 @@ define(function(require, exports, module) {
}
break;
default:
if ("value" in item)
el.lastChild.setAttribute('value', item.value);
if ("onclick" in item)
el.lastChild.onclick = item.onclick;
if ("visible" in item)
el.lastChild.setAttribute("visible", item.visible)
if ("zindex" in item)
el.lastChild.setAttribute("zindex", item.zindex)
var ignoreList = ["onclick"];
Object.keys(item).forEach(function(key) {
if (ignoreList.indexOf(key) > -1) return;
var attributeExists = el.lastChild.attributes.some(function(attribute) {
return (attribute.name === key)
});
if (attributeExists)
el.lastChild.setAttribute(key, item[key]);
});
break;
}
})