1 // $Id$
  2 
  3 /**
  4  * Appends the given items to the given list, optionally inserting a separator
  5  * between the items in the list.
  6  *
  7  * @param {String} list The list to append items to.
  8  * @param {Array} items The list of items to append to the list.
  9  * @param {String} [separator] A string to add between the items.
 10  * @todo Return HTML rather than modify the DOM directly.
 11  */
 12 AjaxSolr.theme.prototype.list_items = function (list, items, separator) {
 13   jQuery(list).empty();
 14   for (var i = 0, l = items.length; i < l; i++) {
 15     var li = jQuery('<li/>');
 16     if (AjaxSolr.isArray(items[i])) {
 17       for (var j = 0, m = items[i].length; j < m; j++) {
 18         if (separator && j > 0) {
 19           li.append(separator);
 20         }
 21         li.append(items[i][j]);
 22       }
 23     }
 24     else {
 25       if (separator && i > 0) {
 26         li.append(separator);
 27       }
 28       li.append(items[i]);
 29     }
 30     jQuery(list).append(li);
 31   }
 32 };
 33