天天看點

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 ,如需轉載請自行聯系原作者

繼續閱讀