我无法使用object中的属性扩展jQuery类。 我需要那个工作:
extend = function(bc,props){}
示例必须正常工作:
var superDiv = extend(jQuery, {
constructor: function() {
// call superclass constructor, if not called it's not call jquery constructor
superDiv.superclass.constructor.call(this, '<div />');
// fires
alert('div was successful created!');
},
magic: function() {
this.addClass('magic-div');
return this;
}
});
(new superDiv()).html('Hello world!').magic().appendTo(document.body);