https://github.com/alexeyraspopov/dom-binder
DOM Binder
https://github.com/alexeyraspopov/dom-binder
Last synced: about 1 month ago
JSON representation
DOM Binder
- Host: GitHub
- URL: https://github.com/alexeyraspopov/dom-binder
- Owner: alexeyraspopov
- Created: 2014-04-23T15:15:02.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-06T20:13:01.000Z (almost 11 years ago)
- Last Synced: 2025-03-18T03:12:30.353Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 297 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# dom-binder
DOM Binder
## Install
```bash
$ component install alexeyraspopov/dom-binder
``````bash
$ bower install dom-binder
```## API
bind(node, attr, observer)
`observer` should provide method `subscribe` which pass a function and call it immediately with latest value.
## Usage
bind(inputElement, 'value', new PathObserver(model, 'user.name'));
## Bindings
Value can be converted in some cases and written like element's property:
| Attr | Binding |
|---------------|----------------|
| value | String(value) |
| checked | Boolean(value) |
| innerHTML | String(value) |
| textContent | String(value) |
| selectedIndex | Number(value) |Else - binding by attribute.
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License) (c) Alexey Raspopov