获取目标元素分属的document对象

获取目标元素所属的document对象?api的用途:获取目标元素所属的document对象。?1、ZYC.dom.g的代码详情在htt

获取目标元素所属的document对象

?

api的用途:获取目标元素所属的document对象

?

1、ZYC.dom.g的代码详情在http://zhangyaochun.iteye.com/blog/1439262

?

2、ownerDocument ?---返回某元素的根元素,此属性是只读

?

3、nodeType =9 ?文档节点

?

?

/**getDocument --get the document object that the target element belong to**@function**@param {HTMLElement|String} element**@return {HTMLElement}**/ZYC.dom.getDocument = function(element){    element = ZYC.dom.g(element);return element.nodeType == 9 ? element.ownerDocument : element.document}