code: function getNearestTypeElement(element) {
  		var $element = $(element),
  			found = $element.is('[data-type]');
  
  		while (!found && $element.length && !$element.is(MODULE_SELECTOR)) {
  			$element = $element.parent();
  			found = $element.is('[data-type]');
  		}
  
  		return found ? $element[0] : 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.