Socket
Socket
Sign inDemoInstall

ampersand-dom-bindings

Package Overview
Dependencies
12
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

6

ampersand-dom-bindings.js

@@ -130,2 +130,8 @@ var Store = require('key-tree-store');

};
} else if (type === 'innerHTML') {
return function (el, value) {
getMatches(el, selector).forEach(function (match) {
dom.html(match, value);
});
};
} else {

@@ -132,0 +138,0 @@ throw new Error('no such binding type: ' + type);

2

package.json
{
"name": "ampersand-dom-bindings",
"description": "Takes binding declarations and returns key-tree-store of functions that can be used to apply those bindings.",
"version": "2.1.0",
"version": "2.2.0",
"author": "'Henrik Joreteg' <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -119,3 +119,13 @@ # ampersand-dom-bindings

### innerHTML
renders innerHTML, can be a string or DOM, based on property value of model
```js
'model.key': {
type: 'innerHTML',
selector: '#something' // or role
}
```
## Handling multiple bindings for a given key

@@ -122,0 +132,0 @@

@@ -141,2 +141,22 @@ var test = require('tape');

test('innerHTML bindings', function (t) {
var el = getEl();
var bindings = domBindings({
'model': {
type: 'innerHTML',
selector: ''
}
});
t.notOk(el.innerHTML, 'should be empty to start');
bindings.run('', null, el, '<span></span>');
t.equal(el.innerHTML, '<span></span>', 'should hav a span now');
bindings.run('', null, el, '');
t.notOk(el.innerHTML, 'should be empty again');
t.end();
});
// TODO: tests for toggle

@@ -143,0 +163,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc