Socket
Socket
Sign inDemoInstall

ampersand-dom-bindings

Package Overview
Dependencies
4
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.1 to 2.3.2

7

ampersand-dom-bindings.js

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

return function (el, value, keyName) {
var name = binding.name || binding.yes || keyName;
var yes = binding.name || binding.yes || keyName;
var no = binding.no;
getMatches(el, selector).forEach(function (match) {
dom.switchClass(match, binding.no, name);
var prevClass = value ? no : yes;
var newClass = value ? yes : no;
dom.switchClass(match, prevClass, newClass);
});

@@ -98,0 +101,0 @@ };

{
"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.3.1",
"version": "2.3.2",
"author": "'Henrik Joreteg' <henrik@andyet.net>",

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

@@ -153,2 +153,27 @@ var test = require('tape');

test('booleanClass yes/no bindings', function (t) {
var el = getEl('<input type="checkbox" class="thing" role="some-role">');
var bindings = domBindings({
'model': {
type: 'booleanClass',
selector: '.thing',
yes: 'awesome',
no: 'not-awesome'
}
});
t.notOk(dom.hasClass(el.firstChild, 'awesome'), 'should not start with yes class');
t.notOk(dom.hasClass(el.firstChild, 'not-awesome'), 'should not start with no class');
bindings.run('', null, el, true);
t.ok(dom.hasClass(el.firstChild, 'awesome'), 'should have yes class');
t.notOk(dom.hasClass(el.firstChild, 'not-awesome'), 'should not have no class');
bindings.run('', null, el, false);
t.notOk(dom.hasClass(el.firstChild, 'awesome'), 'should not have yes class');
t.ok(dom.hasClass(el.firstChild, 'not-awesome'), 'should have no class');
t.end();
});
test('booleanAttribute bindings', function (t) {

@@ -155,0 +180,0 @@ var el = getEl('<input type="checkbox" class="thing" role="some-role">');

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