天天看点

Prototype1.5.1源代码解读分析-1

< DOCTYPE html PUBLIC -WCDTD XHTML TransitionalEN httpwwwworgTRxhtmlDTDxhtml-transitionaldtd>

Prototype对象源代码

下面是prototype框架第一段代码:

var Prototype = {

  Version: '1.5.1',

  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

  },

  BrowserFeatures: {

    XPath: !!document.evaluate,

    ElementExtensions: !!window.HTMLElement,

    SpecificElementExtensions:

      (document.createElement('div').__proto__ !==

       document.createElement('form').__proto__)

  ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',

JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,

  emptyFunction: function() { },

  K: function(x) { return x }

}

本文转自 netcorner 博客园博客,原文链接: http://www.cnblogs.com/netcorner/archive/2007/08/16/2912307.html ,如需转载请自行联系原作者

继续阅读