User:Mike Dillon/Scripts/easydom.js: Difference between revisions

Content deleted Content added
m add elements: "h1", "h2", "h3", "h4", "h5"
enhanced attribute support: skip null attribute values; invoke functions passed as attribute values
Line 12:
 
var attrs = arguments[0];
for (var attrattrName in attrs) {
elem.setAttribute(attr,var attrValue = attrs[attrattrName]);
// Skip null values
if (attrValue == null) {
continue;
}
// Invoke functions and use their result as the value
if (typeof(attrValue) == 'function') {
attrValue = attrValue();
}
// Set the attribute
elem.setAttribute(attrName, attrValue);
}
firstChild = 1;