Content deleted Content added
Mike Dillon (talk | contribs) helper functions... |
Mike Dillon (talk | contribs) m rollback |
||
Line 2:
function createEasyDomFunction(name) {
var
var
var
var
// Creates the DOM element
Line 39 ⟶ 31:
// Invoke function callbacks and use their result as the value,
// unless the attribute name starts with "on" (i.e. an event handler)
if (
// Use direct object property assignment for "on" attributes
if (attrName.indexOf("on") == 0) {
elem[attrName] = attrValue;
Line 47 ⟶ 38:
}
// Invoke the callback otherwise, passing null for "this"
attrValue = attrValue.call(null, elem);
}
Line 57 ⟶ 48:
// Stringify non-string values
if (
attrValue = attrValue.toString();
}
Line 75 ⟶ 66:
}
//
if (args[0] == null) {
return 0;
}
//
if (firstArgType == boolType ||
firstArgType == stringType ||
firstArgType == numberType ||
firstArgType == functionType) {
return 0;
}
//
if (
return 0;
}
//
var attrs = args[0];
for (var attrName in attrs) {
Line 113 ⟶ 108:
continue;
}
▲ if (!isNode(child)) {
child = document.createTextNode(child.toString());
}
|