(function() {
  function clear(element) {
    if (!element) {
      return;
    }
    while (element.firstChild) {
      element.removeChild(element.firstChild);
    }
  }

  function createEmptyState(title, body) {
    var root = document.createElement('div');
    root.className = 'empty-state';

    var titleNode = document.createElement('div');
    titleNode.className = 'empty-state-title';
    titleNode.textContent = title;
    root.appendChild(titleNode);

    var bodyNode = document.createElement('div');
    bodyNode.className = 'empty-state-text';
    bodyNode.textContent = body;
    root.appendChild(bodyNode);

    return root;
  }

  window.CrankDom = {
    clear: clear,
    createEmptyState: createEmptyState,
  };
}());
