MooTools . JavaScript toElement, DOM MooTools. toElement , , toElement() DOM. DOM appendChild.
function DatePicker(date) {
this.date = date;
}
DatePicker.prototype.toElement = function() {
};
var picker = new DatePicker();
:
document.body.appendChild(picker.toElement());
DOM(document.body).append(picker);
, appendChild, .
, . , appendChild, , , toElement, , . , .
(function(original) {
Element.prototype.appendChild = function(child) {
if('toElement' in child) {
original.call(this, child.toElement());
}
else {
original.call(this, child);
}
}
})(Element.prototype.appendChild);
DOM, :
document.body.appendChild(new DatePicker());