日期:2014-05-16  浏览次数:20365 次

javascript类库Prototype.js源码分析之一:继承机制
主要方法:
超级强大的方法(虽然简单)
  function extend(destination, source) {
    for (var property in source)
      destination[property] = source[property];
    return destination;
  }

源码中使用:
? extend(Object, {
??? extend:??????? extend,//集成方法
??? inspect:?????? inspect,//检查方法
??? toJSON:??????? NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON,//转换为JSON字符穿的 方法
??? toQueryString: toQueryString,//查询字符串的方法
??? toHTML:??????? toHTML,//转换为HTML的方法
??? keys:????????? Object.keys || keys,//键集合
??? values:??????? values,//值集合
??? clone:???????? clone,//克隆方法
??? isElement:???? isElement,//判断是否为Element的方法
??? isArray:?????? isArray,//是否为数组的方法
??? isHash:??????? isHash,//是否是散列的方法
??? isFunction:??? isFunction,//是否是函数的方法
??? isString:????? isString,//是否是字符串的方法
??? isNumber:????? isNumber,//是否是数字的方法
??? isDate:??????? isDate,//是否是日期的方法
??? isUndefined:?? isUndefined//是否是undefined
? });
})();

?