public/javascripts/yui/dom/dom-debug.js
function(haystack, needle) {
            haystack = Y.Dom.get(haystack);
            needle = Y.Dom.get(needle);
            
            var ret = false;

            if ( (haystack && needle) && (haystack[NODE_TYPE] && needle[NODE_TYPE]) ) {
                if (haystack.contains && haystack !== needle) { // contains returns true when equal
                    ret = haystack.contains(needle);
                }
                else if (haystack.compareDocumentPosition) { // gecko
                    ret = !!(haystack.compareDocumentPosition(needle) & 16);
                }
            } else {
                YAHOO.log('isAncestor failed; invalid input: ' + haystack + ',' + needle, 'error', 'Dom');
            }
            YAHOO.log('isAncestor(' + haystack + ',' + needle + ' returning ' + ret, 'info', 'Dom');
            return ret;
        }
function(haystack, needle) {
            haystack = Y.Dom.get(haystack);
            needle = Y.Dom.get(needle);
            
            var ret = false;

            if ( (haystack && needle) && (haystack[NODE_TYPE] && needle[NODE_TYPE]) ) {
                if (haystack.contains && haystack !== needle) { // contains returns true when equal
                    ret = haystack.contains(needle);
                }
                else if (haystack.compareDocumentPosition) { // gecko
                    ret = !!(haystack.compareDocumentPosition(needle) & 16);
                }
            } else {
                YAHOO.log('isAncestor failed; invalid input: ' + haystack + ',' + needle, 'error', 'Dom');
            }
            YAHOO.log('isAncestor(' + haystack + ',' + needle + ' returning ' + ret, 'info', 'Dom');
            return ret;
        }
function ( haystack , needle ) { haystack = Y . Dom . get ( haystack ) ; needle = Y . Dom . get ( needle ) ; var ret = false ; if ( ( haystack && needle ) && ( haystack [ NODE_TYPE ] && needle [ NODE_TYPE ] ) ) { if ( haystack . contains && haystack !== needle ) { // contains returns true when equal ret = haystack . contains ( needle ) ; } else if ( haystack . compareDocumentPosition ) { // gecko ret = ! ! ( haystack . compareDocumentPosition ( needle ) & 16 ) ; } } else { YAHOO . log ( 'isAncestor failed; invalid input: ' + haystack + ',' + needle , 'error' , 'Dom' ) ; } YAHOO . log ( 'isAncestor(' + haystack + ',' + needle + ' returning ' + ret , 'info' , 'Dom' ) ; return ret ; }
Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
@method isAncestor
@param {String | HTMLElement} haystack The possible ancestor
@param {String | HTMLElement} needle The possible descendent
@return {Boolean} Whether or not the haystack is an ancestor of needle
Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy .