code: function(element, doc) {
          var ret = false,
              rootNode;
  
          if (element && element.nodeType) {
              (doc) || (doc = element[OWNER_DOCUMENT]);
  
              rootNode = doc[DOCUMENT_ELEMENT];
  
              // contains only works with HTML_ELEMENT
              if (rootNode && rootNode.contains && element.tagName) {
                  ret = rootNode.contains(element);
              } else {
                  ret = Y.DOM.contains(rootNode, element);
              }
          }
  
          return ret;
  
      }
docs: Determines whether or not the HTMLElement is part of the document.
  @method inDoc
  @param {HTMLElement} element The containing html element.
  @param {HTMLElement} doc optional The document to check.
  @return {Boolean} Whether or not the element is attached to the document.