ecma v5定义了一个期待已久的方法:object.getprototypeof,它可以无视型别信息得到某对象的原型([[prototype]]),基于此,我们可以构造出一个resend:(请用chrome 5、ie9预览第三版测试)
美易企业内容管理系统(原美易企业建站系统),是我们结合多年企业建站经验,专门针对中小企业,自主开发的快速建站程序,具有操作简便,扩展功能强大,模板使用简单,网站后续维护成本低等优点,得到众多企业用户的好评。美易企业内容管理系统,所有功能的实现均使用HTML、CSS、JS来实现,完全不需要去修改程序,让用户技术要求更低,使用更简单,功能扩展更方便。程序优势对比美易系统,使用简单:考虑到企业网站管理人
obj.resend = function() {
var pof = Object.getPrototypeOf;
var has = function() {......} // hasOwnProperty的封装
var make = function(obj, old) {
return function(name, args) {
var step = pof(obj),
r;
while (step && !has(step, name)) step = pof(step);
if (!step) throw new Error('Unable to resend: method missing');
var foundMethod = step[name];
var backup = arguments.callee;
this.resend = make(this, backup);
r = foundMethod.apply(this, Array.prototype.slice.call(arguments, 1));
this.resend = old;
return r
}
};
return function(name, args__) {
var rv;
var old = this.resend;
this.resend = make(this, old);
rv = this.resend.apply(this, arguments);
this.resend = original;
return rv;
}
}()










