文章列表
转自: http://ejohn.org/blog/simple-javascript-inheritance/
// 略有改动,以便自己阅读
// Inspired by base2 and Prototype
( function() {
var NAMESPACE = 'Class';
var initializing = false;
var fnTest = /xyz/.test( function() {
'xyz';
} ) ? /\b_super\b/ : /.*/;
// The base Class implementatio ...
Download from "http://www.apress.com/book/downloadfile/3291"
// The Base object constructor
var Base = function(obj){
// Only work if there's something to extend
if (obj)
// If used as Base(), use the prototype of the caller
if (this == window)
...
转自: http://mooui.com/blog/view.aspx?id=1
// 框架名,对象
var MooTools = {
'version' : '1.2dev', // 里程碑版本
'build' : '1519' // trac系统每次change的版本号
};
/*
* Native 是对内置或将之作为内置的对象的包装化
*/
var Native = function(options) {
/*
* 这种写法随处可见,根据ECMA规范,||运算会自动将两侧表达式转化为布尔值,
* 仅当表达式为0/undefined/null/fa ...