0
我正在阅读此源代码,似乎有错误。任何人可以说发生了什么延伸jquery问题
var JX = {
extend: function(bc, sc, o) {
var f = function() {};
f.prototype = sc.prototype;
bc.prototype = new f();
bc.prototype.constructor = bc;
bc.superclass = sc.prototype;
for (var m in o)
bc.prototype[m] = o[m];
}
};
JX.Component = function() {
JX.Component.superclass.init.apply(this, arguments);
};
JX.extend(JX.Component, jQuery, {});
$(document).ready(function() {
var mydiv = new JX.Component(document.createElement('div'));
mydiv.text("Hello World").click(function(){alert("You Clicked Me!")});
mydiv.appendTo(document.body);
alert("heee");
});
后appendTo有一个错误
你能描述这个错误吗? – 2012-03-13 04:13:08
无法将undefined转换为对象 push.apply(ret,elems);这是来自Firefox的控制台..因为这个错误,它停在appendTo,并且下一条语句警报没有被执行 – coool 2012-03-13 04:16:29