有没有人知道YUI库中最接近(元素)(jQuery)的等价物?
答案 0 :(得分:3)
http://yuilibrary.com/yui/docs/api/classes/Node.html#method_ancestor
ancestor(fn,testSelf,stopFn)节点
返回传递由提供的布尔方法应用的测试的最近的祖先。 参数:
fn String | Function
A selector string or boolean method for testing elements. If a function is used, it receives the current node being tested as the only argument.
testSelf Boolean
optional Whether or not to include the element in the scan
stopFn String | Function
optional A selector string or boolean method to indicate when the search should stop. The search bails when the function returns true or the selector matches. If a function is used, it receives the current node being tested as the only argument.
返回: 节点:匹配的节点实例,如果未找到则为null