0.0.6 • Published 8 years ago

dom-mapper v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Small utility to map data attributes to JS objects

Example:

Given the following HTML:

<div id="upload" data-item-count=4></div>
import * as DOM from 'dom-mapper';

// `UploadView` is a react view

// Any CSS supported by querySelectorAll is supported
var map: DOM.ElementMap = {
    '#upload': UploadView,
};

DOM.iterateElementMap(map, (id: string, Klass: any, el: Element, props: any) => {
    // props will be `{itemCount:4}` for #upload
    ReactDom.render(<Klass {...props} />, el);
})

License

MIT

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago