Skip to content

Commit

Permalink
Merge pull request #121 from canjs/major
Browse files Browse the repository at this point in the history
Merge major branch for 6.0 release
  • Loading branch information
matthewp authored Oct 2, 2019
2 parents 7ac906b + 3a18f79 commit adc4c3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 57 deletions.
22 changes: 0 additions & 22 deletions build.js

This file was deleted.

10 changes: 5 additions & 5 deletions can-view-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var getDocument = require('can-globals/document/document');
var domMutate = require('can-dom-mutate');
var domMutateNode = require('can-dom-mutate/node');
var namespace = require('can-namespace');
var nodeLists = require('can-view-nodelist');
var makeFrag = require("can-fragment");
var globals = require('can-globals');
var canSymbol = require('can-symbol');
Expand Down Expand Up @@ -61,7 +60,7 @@ var enableMutationObserver = function() {
disableMutationObserver();
}

var undoOnInsertionHandler = domMutate.onInsertion(docEl, function(mutation) {
var undoOnInsertionHandler = domMutate.onConnected(docEl, function(mutation) {
mountElement(mutation.target);
});
mutationObserverEnabled = true;
Expand Down Expand Up @@ -184,6 +183,7 @@ var tag = function (tagName, tagHandler) {
};

CustomElement.prototype = Object.create(HTMLElement.prototype);
CustomElement.prototype.constructor = CustomElement;

CustomElement.prototype.connectedCallback = function() {
callbacks.tagHandler(this, tagName.toLowerCase(), {});
Expand Down Expand Up @@ -272,10 +272,10 @@ var callbacks = {
scope = scope.add(res);
}

var nodeList = nodeLists.register([], undefined, tagData.parentNodeList || true, false);
nodeList.expression = "<" + el.tagName + ">";
//var nodeList = nodeLists.register([], undefined, tagData.parentNodeList || true, false);
//nodeList.expression = "<" + el.tagName + ">";

var result = tagData.subtemplate(scope, tagData.options, nodeList);
var result = tagData.subtemplate(scope, tagData.options);
var frag = typeof result === "string" ? makeFrag(result) : result;
domMutateNode.appendChild.call(el, frag);
}
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "can-view-callbacks",
"version": "4.4.1",
"version": "5.0.0-pre.2",
"description": "Registered callbacks for behaviors",
"homepage": "https://canjs.com/doc/can-view-callbacks.html",
"repository": {
Expand Down Expand Up @@ -32,24 +32,22 @@
"donejs"
],
"dependencies": {
"can-dom-mutate": "^1.0.0",
"can-dom-mutate": "^2.0.0",
"can-fragment": "^1.0.0",
"can-globals": "^1.0.0",
"can-log": "^1.0.0",
"can-namespace": "1.0.0",
"can-observation-recorder": "^1.0.0",
"can-reflect": "^1.16.7",
"can-symbol": "^1.6.1",
"can-view-nodelist": "^4.0.0"
"can-symbol": "^1.6.1"
},
"devDependencies": {
"can-test-helpers": "^1.0.1",
"can-view-scope": "^4.0.0",
"detect-cyclic-packages": "^1.1.0",
"jshint": "^2.9.1",
"steal": "^1.5.6",
"steal": "^2.0.0",
"steal-qunit": "^2.0.0",
"steal-tools": "^1.4.0",
"testee": "^0.9.0"
}
}
26 changes: 2 additions & 24 deletions test/callbacks-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var QUnit = require('steal-qunit');
var callbacks = require('can-view-callbacks');
var nodeLists = require('can-view-nodelist');
var can = require('can-namespace');
var canSymbol = require('can-symbol');
var clone = require('steal-clone');
Expand All @@ -15,7 +14,8 @@ var supportsCustomElements = 'customElements' in window;
function afterMutation(cb) {
var doc = globals.getKeyValue('document');
var div = doc.createElement("div");
domMutate.onNodeInsertion(div, function(){
var teardown = domMutate.onNodeConnected(div, function(){
teardown();
doc.body.removeChild(div);
setTimeout(cb, 5);
});
Expand Down Expand Up @@ -183,28 +183,6 @@ QUnit.test("can read tags from templateContext.tags", function(assert) {
});
});

QUnit.test("Passes through nodeList", function(assert) {
assert.expect(2);

var nodeList = nodeLists.register([], null, true, false);

var scope = new Scope({});

callbacks.tag("nodelist-tag", function(){
return {};
});
var el = document.createElement("div");
callbacks.tagHandler(el, "nodelist-tag", {
scope: scope,
parentNodeList: nodeList,
subtemplate: function(scope, helpers, localNodeList){
assert.ok(localNodeList, "nodeList was provided");
assert.equal(localNodeList.parentList, nodeList, "it is our provided nodeList");
return "<div></div>";
}
});
});

QUnit.test("tag handler is called automatically when elements are inserted into the page", function(assert) {
var fixture = document.getElementById('qunit-fixture');

Expand Down

0 comments on commit adc4c3b

Please sign in to comment.