var DOC = document;
//获取DOM节点对象
getDom : function(el, strict){//el-->id 或者 html节点,strict-->是否只支持ID属性(ie下IE的name属性也能获取)获取节点对象
if(!el || !DOC){
return null;
}
if (el.dom){
return el.dom;
} else {
if (typeof el == 'string') {//如果传的参数是字符串,就当是ID处理
var e = DOC.getElementById(el);
// IE returns elements with the 'name' and 'id' attribute.
// we do a strict check to return the element with only the id attribute
if (e && isIE && strict) {
if (el == e.getAttribute('id')) {
return e;
} else {
return null;
}
}
return e;
} else {
return el;
}
}
},
getBody : function(){//获取文档的body节点对象
return Ext.get(DOC.body || DOC.documentElement);
}
extjs源码分析-005(Ext.getDom,Ext.getBody)
最新推荐文章于 2021-02-23 12:25:59 发布