开始阅读prototype1.5(参照9esuLuciano blog的注释和自己的理解)第一天

本文介绍了Prototype JavaScript框架1.5.1.1版本的核心特性与浏览器兼容性检查方式。该框架使用MIT许可发布,提供了版本信息及对不同浏览器的支持情况判断。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
  1. /*  Prototype JavaScript framework, version 1.5.1.1  
  2.  *  (c) 2005-2007 Sam Stephenson  
  3.  *  
  4.  *  Prototype is freely distributable under the terms of an MIT-style license.  
  5.  *  For details, see the Prototype web site: http://www.prototypejs.org/  
  6.  *  
  7. /*--------------------------------------------------------------------------*/  
  8.   
  9. /*创建一个prototype对象,包含当前Prototype的版本以及当前浏览器信息*/  
  10. /*var prototype{}来创建对象,version:‘1.5.1.1’对象的属性创建*/
  11. var Prototype = {   
  12.   Version: '1.5.1.1',   
  13.   
  14. /*这个方法用的很巧,将一个NaN或者undefined对象通过两次!运算,得到false*/  
  15.   Browser: {   
  16.     IE:     !!(window.attachEvent && !window.opera),   
  17.     Opera:  !!window.opera,   
  18.     WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,   
  19.     Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1   
  20.   },   
    • /*IE6.0和Firefox2.0都不支持XPath*/  
    • /*IE6.0不支持ElementExtensions,Firefox则支持*/  
    •   BrowserFeatures: {   
    •     XPath: !!document.evaluate,   
    •     ElementExtensions: !!window.HTMLElement,   
    •     SpecificElementExtensions:   
    •       (document.createElement('div').__proto__ !==   
    •        document.createElement('form').__proto__)   
    •   },   
    •   
    • /*正则,用来抽取出页面上用<script ...> ... </script>标记的代码段*/  
    •   ScriptFragment: '<script[^>]*>([//S//s]*?)<//script>',   
    •   JSONFilter: /^///*-secure-([/s/S]*)/*///s*$/,   
    •   
    • /*定义一个空函数*/  
    •   emptyFunction: function() { },   
    • /*暂时不明白定义这个函数的用意*/  
    •   K: function(x) { return x }   
    • }   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值