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 3.1.1 to 3.1.2

.jshintignore

6

ampersand-dom-bindings.js
var Store = require('key-tree-store');
var isArray = require('is-array');
var dom = require('ampersand-dom');

@@ -38,3 +37,3 @@ var matchesSelector = require('matches-selector');

function getMatches(el, selector, func) {
function getMatches(el, selector) {
if (selector === '') return [el];

@@ -52,3 +51,2 @@ var matches = [];

var type = binding.type || 'text';
var hasSelector = true;
var selector = (function () {

@@ -58,3 +56,3 @@ if (typeof binding.selector === 'string') {

} else if (binding.hook) {
return '[data-hook="' + binding.hook + '"]';
return '[data-hook~="' + binding.hook + '"]';
} else {

@@ -61,0 +59,0 @@ return '';

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

@@ -17,3 +17,5 @@ "bugs": {

"browserify": "^5.11.0",
"jshint": "^2.5.6",
"phantomjs": "^1.9.7-15",
"precommit-hook": "^1.0.7",
"run-browser": "~1.3.1",

@@ -20,0 +22,0 @@ "tap-spec": "^0.2.0",

@@ -421,1 +421,19 @@ var test = require('tape');

// TODO: tests for multiple bindings in one declaration
test('Issue #20, Ensure support for space-separated `data-hook`s', function (t) {
var el = getEl('<span class="thing" data-hook="hello other"></span>');
var bindings = domBindings({
'model1': {
type: 'text',
hook: 'other'
}
});
bindings.run('model1', null, el, 'first');
t.equal(el.firstChild.textContent, 'first');
bindings.run('model1', null, el, 'second');
t.equal(el.firstChild.innerHTML, 'second');
t.end();
});
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