在MooTools中,是否可以执行以下操作:
var MyClass = new Class({
initialize: function (el) {
this.element = document.id(el);
}
});
console.log( instanceOf(document.id('test-div'), Element ); // Logs: 'true'
var instance = new MyClass('test-div');
console.log( instanceOf(instance, MyClass ); // expected result: 'true'
console.log( instanceOf(document.id('test-div'), MyClass ); // expected result: 'true'
换句话说,如果我的类已经在元素上实例化,它应该返回“MyClass”而不是“Element”