首页  |  IT相关文档  |  工具软件  |  网站建设  |  程式开发  |  图形设计  |  操作系统  |  服务器类  |  数据库类  |  网络安全  |  网络技术  |  计算机应用  |  站长之家  |  网络游戏
 

热点文章

IT动态

·淘宝与日本雅虎强强联合推出跨国交
·2010年电子书迎来黄金年
·雅虎持巨资对抗谷歌推广
·从BT站点关闭到恢复看待网站转型
·微软Docs.com平台今日正式上线
·谷歌第一季度疯狂收购10家公司
·百度即将推出PC端输入法
·IE市场份额首次跌破60%
·赛迪澄清虚假上市公告
·Opera针对漏洞发布Win/Mac平台10.5
·看待google展示光纤速度
·站长应该抓住有效的长尾机会

GG搜索更多相关
 
当前位置:主页>程式开发>Ajax教程>

prototype.js 1.4 原代码阅读

来源: 作者: 发布时间:2007-05-26

        }
        t=t.substring(0,cursor);
      } while (cursor>0);
      this.s[i]=s;
    }
  },
 
  get:function(root) {
    this.explore(root || document,this.i==(this.s.length-1));
    return this.r;
  },
 
  explore:function(elt,leaf) {
   
    var s=this.s[this.i];
   
    var r=[];
   
    if (s[1]) {
   
      e=$(s[1]);     
      if (e && (s[0]=="*" || e.tagName==s[0]) && e.childOf(elt)) {
       r=[e];
      }
     
    } else {
      r=$A(elt.getElementsByTagName(s[0]));
    }
   
    if (s[2].length==1) { //single classname
      r=r.findAll(function(o) {
     
        if (o.className.indexOf(" ")==-1) {
          return o.className==s[2][0];
        } else {
          return o.className.split(/\s+/).include(s[2][0]);
        }
      });
   
    } else if (s[2].length>0) {

r=r.findAll(function(o) {
     
        if (o.className.indexOf(" ")==-1) {
          return false;
        } else {
       
          var q=o.className.split(/\s+/);
          return s[2].all(function(c) {
            return q.include(c);
          });
        }
      });
    }
   
   
    if (leaf) {
      this.r=this.r.concat(r);
     
    } else {
      ++this.i;
      r.each(function(o) {
        this.explore(o,this.i==(this.s.length-1));
      }.bind(this));
    }
  }
 
}


var $$old=$$;

var $$=function(a,b) {

  if (b || a.indexOf("[")>=0) return $$old.apply(this,arguments);
 
  return new SelectorLiteAddon(a.split(/\s+/)).get();
}

评论 | 收藏 | | 打印 | 关闭
相关链接
     
 

Copyright 2006-2007 xhit.cn All Rights Reserved
有什么建议或意见请发信到admin@xhit.cn 皖ICP备07007336