src/console/simpleyui.js
function(element, needle) {
        var ret = false;

        if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) {
            ret = false;
        } else if (element[CONTAINS])  {
            if (Y.UA.opera || needle[NODE_TYPE] === 1) { // IE & SAF contains fail if needle not an ELEMENT_NODE
                ret = element[CONTAINS](needle);
            } else {
                ret = Y.DOM._bruteContains(element, needle); 
            }
        } else if (element[COMPARE_DOCUMENT_POSITION]) { // gecko
            if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) { 
                ret = true;
            }
        }

        return ret;
    }
function(element, needle) {
        var ret = false;

        if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) {
            ret = false;
        } else if (element[CONTAINS])  {
            if (Y.UA.opera || needle[NODE_TYPE] === 1) { // IE & SAF contains fail if needle not an ELEMENT_NODE
                ret = element[CONTAINS](needle);
            } else {
                ret = Y.DOM._bruteContains(element, needle); 
            }
        } else if (element[COMPARE_DOCUMENT_POSITION]) { // gecko
            if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) { 
                ret = true;
            }
        }

        return ret;
    }
function ( element , needle ) { var ret = false ; if ( ! needle || ! element || ! needle [ NODE_TYPE ] || ! element [ NODE_TYPE ] ) { ret = false ; } else if ( element [ CONTAINS ] ) { if ( Y . UA . opera || needle [ NODE_TYPE ] === 1 ) { // IE & SAF contains fail if needle not an ELEMENT_NODE ret = element [ CONTAINS ] ( needle ) ; } else { ret = Y . DOM . _bruteContains ( element , needle ) ; } } else if ( element [ COMPARE_DOCUMENT_POSITION ] ) { // gecko if ( element === needle || ! ! ( element [ COMPARE_DOCUMENT_POSITION ] ( needle ) & 16 ) ) { ret = true ; } } return ret ; }
Determines whether or not one HTMLElement is or contains another HTMLElement.
@method contains
@param {HTMLElement} element The containing html element.
@param {HTMLElement} needle The html element that may be contained.
@return {Boolean} Whether or not the element is or contains the needle.
Determines whether or not one HTMLElement is or contains another HTMLElement .