code: function contains(container, contained, className) {
          var current = contained;
  
          while (current && current.ownerDocument && current.nodeType !== 11) {
              if (className) {
                  if (current === container) {
                      return false;
                  }
                  if (current.className.indexOf(className) >= 0) { //current.classList.contains(className) doesn't work in IE9
                      return true;
                  }
              } else {
                  if (current === container) {
                      return true;
                  }
              }
              current = current.parentNode;
          }
  
          return false;
      }
docs: Check to see if a DOM element is a descendant of another DOM element.
  
  @param {DOM element} container
  @param {DOM element} contained
  @param {string} class name of element in container
  @returns {boolean}