2
有沒有人知道YUI庫中最接近(元素)(jQuery)的等價物?在YUI中什麼等價於最接近的(元素)(jQuery)?
有沒有人知道YUI庫中最接近(元素)(jQuery)的等價物?在YUI中什麼等價於最接近的(元素)(jQuery)?
http://yuilibrary.com/yui/docs/api/classes/Node.html#method_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.
返回: 節點:一致節點實例或空,如果沒有找到
值得一提的是,YUI的'ancestor'不,本身相當於jQuery的'closest'。默認情況下'最接近'考慮當前元素/節點,而'ancestor'需要'true'作爲第二個參數傳遞以包含當前元素。 – nagytech