I switched to using this function to create element:
----------------------------------------------------
function elem(name, attrs, style, text) {
var e = document.create Element(name);
if (attrs) {
for (key in attrs) {
if (key == 'class') {
e.className = attrs[key];
} else if (key == 'id') {
e.id = attrs[key];
} else {
e.setAttribute( key, attrs[key]);
}
}
}
if (style) {
for (key in style) {
e.style[key] = style[key];
}
}
if (text) {
e.appendChild(d ocument.createT extNode(text));
}
return e;
}
---------------------------------------------------------
so instead of the "old" way:
var oMyDiv = document.create Element("DIV");
oMyDiv.setAttri bute("id","test id");
oMyDiv.classNam e = "testclass" ;
I use that function :
var oMyDiv = elem('DIV', {'id':'testid', 'class':'testcl ass'});
The rendered source shows this:
<div extend=" function (object) {return Object.extend.a pply(this, [this,
object]); } "
class="testclas s" id="testid">
Question: I don';t understand the "EXTEND" part......anywa ys does it look
legit/right ?
Any if you please put this "extend=" function (object) {return
Object.extend.a pply(this, [this, object]); } "
in English ;)
thanks