marcelklehr / vdom-virtualize

Virtualize a DOM node
MIT License
131 stars 27 forks source link

Add support for naming a key attribute to use as key values for vnodes #44

Open gryphonmyers opened 5 years ago

gryphonmyers commented 5 years ago

I needed this feature, so here's a PR.

var myDomNode = document.createElement('div');
myDomNode.id = 'foo';

virtualize(myDomNode, 'id')
/*
will yield something not unlike:
 {
    children: [],
    properties: { id: 'foo' },
    key: 'foo'
  }
*/