Tnx,
DizyArt
- A string of HTML (how Prototype worked up until 1.5.2)
- An Element (either something you build with new Element or something
you get from the dom -- ie, $("something"))
- An object that responds to "toElement", which should return an Element object.
- An object that responds to "toHTML", which should return a string of HTML.
So for example:
var Person = Class.create({
initialize: function(name) {
this.name = name;
},
toElement: function() {
return new Element("li", { className: "person" }).update(this.name);
}
});
var john = new Person("John");
$("people").insert(john);
Should work fine :)
Best,
-Nicolas