I have the following function :
var applyStyling = function (element, object) {
return _.each(object, function (value, key) {
// determine whether the key should be treated as an attribute or style
if(style)
element.style.key = value
element.setAttribute(key, value)
})
}
An example use would be something like
applyStyling('some dom element', {'id' : 'someID', 'zIndex' : 10})
How can I detect if the key should be treated as a style or attribute? I could only find how to check if attribute/style has been set on an element.
Aucun commentaire:
Enregistrer un commentaire