code: function getNearestTypeElement(element) {
  		var found = false;
  		var moduleBoundaryReached = false;
  
  		// We need to check for the existence of 'element' since occasionally we call this on a detached element node.
  		// For example:
  		//  1. event handlers like mouseout may sometimes detach nodes from the DOM
  		//  2. event handlers like mouseleave will still fire on the detached node
  		// Checking existence of element.parentNode ensures the element is a valid HTML Element
  		while (!found && element && element.parentNode && !moduleBoundaryReached) {
  			found = isTypeElement(element);
  			moduleBoundaryReached = isModuleElement(element);
  
  			if (!found) {
  				element = element.parentNode;
  			}
  
  		}
  
  		return found ? element : null;
  	}
docs: Finds the closest ancestor that of an element that has a data-type
  attribute.
  @param {HTMLElement} element The element to start searching from.
  @returns {HTMLElement} The matching element or null if not found.