can-stache-bindings
Advanced tools
Comparing version 4.6.5 to 4.7.0
@@ -36,3 +36,3 @@ "use strict"; | ||
var canEvent = require("can-attribute-observable/event"); | ||
var canEventQueue = require("can-event-queue"); | ||
@@ -92,4 +92,7 @@ // Contains all of the stache bindings that will be exported. | ||
}; | ||
var onKeyValueSymbol = canSymbol.for("can.onKeyValue"); | ||
var makeScopeFromEvent = function(element, event, viewModel, args, data, bindingContext){ | ||
// TODO: Remove in 6.0. In 4 and 5 arguments were wrong. | ||
var shiftArgumentsForLegacyArguments = bindingContext[onKeyValueSymbol] !== undefined; | ||
var makeScopeFromEvent = function(element, event, viewModel, args, data){ | ||
var specialValues = { | ||
@@ -99,3 +102,4 @@ element: element, | ||
viewModel: viewModel, | ||
arguments: args | ||
arguments: shiftArgumentsForLegacyArguments ? Array.from(args).slice(1) : args, | ||
args: args | ||
}; | ||
@@ -196,3 +200,3 @@ | ||
// the element is removed, or the attribute changes values. | ||
canReflect.each(el.attributes || [], function(node) { | ||
canReflect.eachListLike(el.attributes || [], function(node) { | ||
var dataBinding = makeDataBinding(node, el, { | ||
@@ -484,3 +488,3 @@ templateType: tagData.templateType, | ||
var runScope = makeScopeFromEvent(el, ev, viewModel, arguments, data); | ||
var runScope = makeScopeFromEvent(el, ev, viewModel, arguments, data, bindingContext); | ||
@@ -520,3 +524,3 @@ if (expr instanceof expression.Hashes) { | ||
var unbindEvent = function() { | ||
canEvent.off.call(bindingContext, event, handler); | ||
canEventQueue.off.call(bindingContext, event, handler); | ||
if (attributesDisposal) { | ||
@@ -534,3 +538,4 @@ attributesDisposal(); | ||
// attribute name (can-click="foo") | ||
canEvent.on.call(bindingContext, event, handler); | ||
canEventQueue.on.call(bindingContext, event, handler); | ||
attributesDisposal = domMutate.onNodeAttributeChange(el, attributesHandler); | ||
@@ -537,0 +542,0 @@ removalDisposal = domMutate.onNodeRemoval(el, removalHandler); |
{ | ||
"name": "can-stache-bindings", | ||
"version": "4.6.5", | ||
"version": "4.7.0", | ||
"description": "Default binding syntaxes for can-stache", | ||
@@ -38,5 +38,5 @@ "homepage": "https://canjs.com/doc/can-stache-bindings.html", | ||
"can-dom-data-state": "^1.0.0", | ||
"can-dom-events": "^1.1.1", | ||
"can-dom-events": "^1.3.3", | ||
"can-dom-mutate": "^1.3.0", | ||
"can-event-queue": "^1.0.0", | ||
"can-event-queue": "^1.1.4", | ||
"can-log": "^1.0.0", | ||
@@ -55,3 +55,3 @@ "can-observation-recorder": "^1.0.0", | ||
"can-view-model": "^4.0.0", | ||
"can-view-scope": "^4.0.0" | ||
"can-view-scope": "^4.13.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "devDependencies": { |
@@ -804,2 +804,22 @@ var QUnit = require('steal-qunit'); | ||
}); | ||
QUnit.test("scope.event should be available", function() { | ||
var vm = new SimpleMap({}); | ||
MockComponent.extend({ | ||
tag: "event-producer", | ||
viewModel: vm, | ||
template: stache('') | ||
}); | ||
var template = stache("<event-producer on:event='this.doSomething(scope.event, scope.arguments, scope.args)'/>"); | ||
template({ | ||
doSomething: function(events, argums, args){ | ||
QUnit.equal(events.type , "event", "got an event"); | ||
QUnit.equal(argums.length, 2, "two arguments"); | ||
QUnit.equal(args.length, 3, "3 args"); | ||
} | ||
}); | ||
vm.dispatch({type: "event"},[1,2]); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178877
3912
Updatedcan-dom-events@^1.3.3
Updatedcan-event-queue@^1.1.4
Updatedcan-view-scope@^4.13.0