regular-table icon indicating copy to clipboard operation
regular-table copied to clipboard

Add Support for Content Types like NodeList

Open jjeising opened this issue 5 years ago • 0 comments

Feature Request

Description of Problem:

I'm trying to convert existing tables to regular-table. These tables use multiple HTML elements like buttons with hover. When multiple elements are not wrapped in a single HTMLElement they can currently not be added to a td.

Potential Solutions:

I've currently monkey patched this:

  } else if (val instanceof NodeList) {
    td.textContent = "";
    
    Array.prototype.forEach.call(val, (node) => {
      td.appendChild(node.cloneNode(true));
    });
  } else {

To stay in line with the rest this should probably only use appendChild without clone, but this would require a clone in the data listener, as these nodes are lost when they leave the view.

A more general alternative would a custom callback. This would maybe also allow usage of removeChild to keep a single instance of the nodes, which may be faster.

jjeising avatar Oct 25 '20 18:10 jjeising