Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-stache-bindings

Package Overview
Dependencies
Maintainers
13
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-stache-bindings - npm Package Compare versions

Comparing version 4.2.2 to 4.2.3

39

can-stache-bindings.js

@@ -32,2 +32,3 @@ // # can-stache-bindings.js

var makeCompute = require("can-view-scope/make-compute-like");
var ViewNodeList = require("can-view-nodelist");

@@ -238,3 +239,5 @@ var canEvent = require("can-attribute-observable/event");

semaphore = {},
teardown;
teardown,
attributeDisposal,
removedDisposal;

@@ -294,10 +297,13 @@ // Setup binding

};
// Listen for changes
teardown = dataBinding.onTeardown;
var attributeDisposal = domMutate.onNodeAttributeChange(el, attributeListener);
var removedDisposal = domMutate.onNodeRemoval(el, function () {
var tearItAllDown = function(){
if (el.ownerDocument.contains(el)) {
return;
}
teardown();
if(teardown) {
teardown();
teardown = undefined;
}
if (removedDisposal) {

@@ -311,3 +317,13 @@ removedDisposal();

}
});
};
if(attrData.nodeList) {
ViewNodeList.register([],tearItAllDown, attrData.nodeList, false);
}
// Listen for changes
teardown = dataBinding.onTeardown;
attributeDisposal = domMutate.onNodeAttributeChange(el, attributeListener);
removedDisposal = domMutate.onNodeRemoval(el, tearItAllDown);
},

@@ -652,2 +668,5 @@ // ### bindings.behaviors.event

function updateParent(newVal) {
if(!bindingInfo.active) {
return;
}
if (!bindingsSemaphore[attrName]) {

@@ -721,2 +740,5 @@ if (parentObservable && parentObservable[getValueSymbol]) {

var updateChild = function updateChild(newValue) {
if(!bindingInfo.active) {
return;
}
// Save the viewModel property name so it is not updated multiple times.

@@ -914,2 +936,4 @@ // We listen for when the batch has ended, and all observation updates have ended.

}
// hack in the active check (#278)
bindingInfo.active = true;

@@ -983,2 +1007,3 @@ // assign some bindingData props to the bindingInfo

var onTeardown = function() {
bindingInfo.active = false;
unbindUpdate(parentObservable, updateChild);

@@ -985,0 +1010,0 @@ unbindUpdate(childObservable, updateParent);

2

package.json
{
"name": "can-stache-bindings",
"version": "4.2.2",
"version": "4.2.3",
"description": "Default binding syntaxes for can-stache",

@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-stache-bindings.html",

@@ -375,2 +375,16 @@ var QUnit = require('steal-qunit');

QUnit.test("parent stache is able to teardown child bindings (#278)", function(){
var map = new SimpleMap({value: "VALUE"});
var template = stache("<div>{{#if value}}<span><input value:bind='value'/></span>{{/if}}</div>");
var frag = template(map),
input = frag.firstChild.getElementsByTagName("input")[0];
QUnit.equal(input.value, "VALUE", "value set initially");
map.set("value","");
QUnit.equal(input.value, "VALUE", "value should not have been updated");
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc