can-view-callbacks
Advanced tools
Comparing version 4.0.0-pre.3 to 4.0.0-pre.4
@@ -107,3 +107,3 @@ var ObservationRecorder = require('can-observation-recorder'); | ||
tagHandler: function(el, tagName, tagData){ | ||
var helperTagCallback = tagData.options.get('tags.' + tagName,{proxyMethods: false}), | ||
var helperTagCallback = tagData.scope.templateContext.tags.get(tagName), | ||
tagCallback = helperTagCallback || tags[tagName]; | ||
@@ -110,0 +110,0 @@ |
{ | ||
"name": "can-view-callbacks", | ||
"version": "4.0.0-pre.3", | ||
"version": "4.0.0-pre.4", | ||
"description": "Registered callbacks for behaviors", | ||
@@ -47,2 +47,3 @@ "homepage": "https://canjs.com/doc/can-view-callbacks.html", | ||
"can-test-helpers": "^1.0.1", | ||
"can-view-scope": "^4.0.0-pre.34", | ||
"detect-cyclic-packages": "^1.1.0", | ||
@@ -49,0 +50,0 @@ "done-serve": "^1.2.0", |
@@ -7,2 +7,3 @@ var QUnit = require('steal-qunit'); | ||
var devUtils = require("can-test-helpers/lib/dev"); | ||
var Scope = require("can-view-scope"); | ||
@@ -147,6 +148,24 @@ QUnit.module('can-view-callbacks'); | ||
callbacks.tagHandler(customElement, customElement.tagName, { | ||
options: { | ||
get: function noop(){} | ||
} | ||
scope: new Scope({}) | ||
}); | ||
} | ||
QUnit.test("can read tags from templateContext.tags", function() { | ||
var globalHandler = function() { | ||
QUnit.ok(false, 'global handler should not be called'); | ||
return 'global data'; | ||
}; | ||
callbacks.tag('foo', globalHandler); | ||
var scope = new Scope({}); | ||
var localHandler = function() { | ||
QUnit.ok(true, 'local handler called'); | ||
return 'local data'; | ||
}; | ||
scope.templateContext.tags.set('foo', localHandler); | ||
var el = document.createElement('div'); | ||
var fooHandler = callbacks.tagHandler(el, 'foo', { | ||
scope: scope | ||
}); | ||
}); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
32061
300
0
9
17