用户操作
[即时聊天] [发私信] [加为好友]
寒冬ID:dead_of_winter
19681次访问,排名6329,好友3人,关注者6人。
from ATC
dead_of_winter的文章
原创 41 篇
翻译 1 篇
转载 13 篇
评论 21 篇
最近评论
dead_of_winter:prototype只是特定时代的东西 几个极其稀有的“高手”把自己的公共代码分享出来给大家用 根本说不上是框架
prototype只用了一行代码 就能让我们这些程序员彻底对它绝望:
RegExp.prototype.match = RegExp.prototype.test;
mackyliu:显然选用框架的人大多数只是应用者,对于许多真正的开发者来说,可能更多的只是选用各个框架里比较优秀的一小段代码而已,prototype的确"污染了"许多对象,但使用者似乎也根本不需要去考虑对象的实质应用处理过程,有好的类来替代一个相对复杂的处理过程,无疑是菜鸟们的一大福音。然而对于我们搞程序的人来说,可能更多的会去关注一个框架的扩展性
dead_of_winter:hoho 不是这样的 QQ上详细说吧:)
BlueDestiny:循环引用是三者之间(或三者以上)的相互引用,只用切断其一就可以了
<html>
<head>
<script language="JScript">

var myGlobalObject;

function SetupLeak()
{
// First……
dead_of_winter:我不怀疑prototype作者的水平 不过它写得实在太随意了 不像是写框架的态度
还有啊 pt该补习下OO基础知识了 Insertion这种东西最好就别出现了- -#
YUI有多好先不说 起码这些基本的地方做得不错
文章分类
收藏
    相册
    贴图
    ACM
    哈尔滨工程大学ACM
    .net framework3.0
    中国科技大学ACM
    俄罗斯乌拉尔大学ACM......
    北京大学ACM
    吉林大学ACM(故障?)
    同济大学ACM
    哈尔滨工业大学ACM
    四川大学ACM
    天津大学ACM
    暨南大学珠海学院ACM
    杭州电子科技大学ACM
    汕头大学ACM
    浙江大学ACM
    CSDN BLOGS
    50米深蓝
    chenhu_doc
    一刀流
    小三
    搜索如风
    程化
    雁南飞
    泡的bbs
    无忧脚本
    资源
    WindowsAPI参考
    wpf(RSS)
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 prototype1.6源码收藏

    新一篇: C#印象 | 旧一篇: 彻悟javascript的new




    /*  Prototype JavaScript framework, version 1.6.0.2
     *  (c) 2005-2008 Sam Stephenson
     *
     *  Prototype is freely distributable under the terms of an MIT-style license.
     *  For details, see the Prototype web site: http://www.prototypejs.org/
     *
     *--------------------------------------------------------------------------
    */

    var Prototype = {
      Version: 
    '1.6.0.2',

      Browser: 
    {
        IE:     
    !!(window.attachEvent && !window.opera),
        Opera:  
    !!window.opera,
        WebKit: navigator.userAgent.indexOf(
    'AppleWebKit/'> -1,
        Gecko:  navigator.userAgent.indexOf(
    'Gecko'> -1 && navigator.userAgent.indexOf('KHTML'== -1,
        MobileSafari: 
    !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
      }
    ,

      BrowserFeatures: 
    {
        XPath: 
    !!document.evaluate,
        ElementExtensions: 
    !!window.HTMLElement,
        SpecificElementExtensions:
          document.createElement(
    'div').__proto__ &&
          document.createElement(
    'div').__proto__ !==
            document.createElement(
    'form').__proto__
      }
    ,

      ScriptFragment: 
    '<script[^>]*>([\S\s]*?)</script>',
      JSONFilter: 
    /^/*-secure-([sS]*)*/s*$/,

      emptyFunction: 
    function() { },
      K: 
    function(x) return x }
    }
    ;

    if (Prototype.Browser.MobileSafari)
      Prototype.BrowserFeatures.SpecificElementExtensions 
    = false;
    /* Based on Alex Arnell's inheritance implementation. */
    var Class = {
      create: 
    function() {
        
    var parent = null, properties = $A(arguments);
        
    if (Object.isFunction(properties[0]))
          parent 
    = properties.shift();

        
    function klass() {
          
    this.initialize.apply(this, arguments);
        }


        Object.extend(klass, Class.Methods);
        klass.superclass 
    = parent;
        klass.subclasses 
    = [];

        
    if (parent) {
          
    var subclass = function() { };
          subclass.prototype 
    = parent.prototype;
          klass.prototype 
    = new subclass;
          parent.subclasses.push(klass);
        }


        
    for (var i = 0; i < properties.length; i++)
          klass.addMethods(properties[i]);

        
    if (!klass.prototype.initialize)
          klass.prototype.initialize 
    = Prototype.emptyFunction;

        klass.prototype.constructor 
    = klass;

        
    return klass;
      }

    }
    ;

    Class.Methods 
    = {
      addMethods: 
    function(source) {
        
    var ancestor   = this.superclass && this.superclass.prototype;
        
    var properties = Object.keys(source);

        
    if (!Object.keys({ toString: true }).length)
          properties.push(
    "toString""valueOf");

        
    for (var i = 0, length = properties.length; i < length; i++{
          
    var property = properties[i], value = source[property];
          
    if (ancestor && Object.isFunction(value) &&
              value.argumentNames().first() 
    == "$super"{
            
    var method = value, value = Object.extend((function(m) {
              
    return function() return ancestor[m].apply(this, arguments) };
            }
    )(property).wrap(method), {
              valueOf:  
    function() return method },
              toString: 
    function() return method.toString() }
            }
    );
          }

          
    this.prototype[property] = value;
        }


        
    return this;
      }

    }
    ;
    var Abstract = { };

    Object.extend 
    = function(destination, source) {
      
    for (var property in source)
        destination[property] 
    = source[property];
      
    return destination;
    }
    ;

    Object.extend(Object, 
    {
      inspect: 
    function(object) {
        
    try {
          
    if (Object.isUndefined(object)) return 'undefined';
          
    if (object === nullreturn 'null';
          
    return object.inspect ? object.inspect() : String(object);
        }
     catch (e) {
          
    if (e instanceof RangeError) return '...';
          
    throw e;
        }

      }
    ,

      toJSON: 
    function(object) {
        
    var type = typeof object;
        
    switch (type) {
          
    case 'undefined':
          
    case 'function':
          
    case 'unknown'return;
          
    case 'boolean'return object.toString();
        }


        
    if (object === nullreturn 'null';
        
    if (object.toJSON) return object.toJSON();
        
    if (Object.isElement(object)) return;

        
    var results = [];
        
    for (var property in object) {
          
    var value = Object.toJSON(object[property]);
          
    if (!Object.isUndefined(value))
            results.push(property.toJSON() 
    + '' + value);
        }


        
    return '{' + results.join(''+ '}';
      }
    ,

      toQueryString: 
    function(object) {
        
    return $H(object).toQueryString();
      }
    ,

      toHTML: 
    function(object) {
        
    return object && object.toHTML ? object.toHTML() : String.interpret(object);
      }
    ,

      keys: 
    function(object) {
        
    var keys = [];
        
    for (var property in object)
          keys.push(property);
        
    return keys;
      }
    ,

      values: 
    function(object) {
        
    var values = [];
        
    for (var property in object)
          values.push(object[property]);
        
    return values;
      }
    ,

      clone: 
    function(object) {
        
    return Object.extend({ }, object);
      }
    ,

      isElement: 
    function(object) {
        
    return object && object.nodeType == 1;
      }
    ,

      isArray: 
    function(object) {
        
    return object != null && typeof object == "object" &&
          
    'splice' in object && 'join' in object;
      }
    ,

      isHash: 
    function(object) {
        
    return object instanceof Hash;
      }
    ,

      isFunction: 
    function(object) {
        
    return typeof object == "function";
      }
    ,

      isString: 
    function(object) {
        
    return typeof object == "string";
      }
    ,

      isNumber: 
    function(object) {
        
    return typeof object == "number";
      }
    ,

      isUndefined: 
    function(object) {
        
    return typeof object == "undefined";
      }

    }
    );

    Object.extend(Function.prototype, 
    {
      argumentNames: 
    function() {
        
    var names = this.toString().match(/^[s(]*function[^(]*((.*?))/)[1].split(",").invoke("strip");
        
    return names.length == 1 && !names[0? [] : names;
      }
    ,

      bind: 
    function() {
        
    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
        
    var __method = this, args = $A(arguments), object = args.shift();
        
    return function() {
          
    return __method.apply(object, args.concat($A(arguments)));
        }

      }
    ,

      bindAsEventListener: 
    function() {
        
    var __method = this, args = $A(arguments), object = args.shift();
        
    return function(event) {
          
    return __method.apply(object, [event || window.event].concat(args));
        }

      }
    ,

      curry: 
    function() {