can-view-import
Advanced tools
Comparing version 4.0.0-pre.8 to 4.0.0-pre.9
var assign = require('can-assign'); | ||
var canData = require('can-dom-data-state'); | ||
var canSymbol = require('can-symbol'); | ||
var DOCUMENT = require("can-globals/document/document"); | ||
var getChildNodes = require('can-util/dom/child-nodes/child-nodes'); | ||
var importer = require('can-util/js/import/import'); | ||
var mutate = require("can-util/dom/mutate/mutate"); | ||
var domMutate = require('can-dom-mutate'); | ||
var domMutateNode = require("can-dom-mutate/node"); | ||
var nodeLists = require('can-view-nodelist'); | ||
@@ -12,5 +14,6 @@ var viewCallbacks = require('can-view-callbacks'); | ||
var dev = require("can-log/dev/dev"); | ||
var domEvents = require("can-util/dom/events/events"); | ||
require("can-util/dom/events/removed/removed"); | ||
function setViewModel (element, viewModel) { | ||
element[canSymbol.for('can.viewModel')] = viewModel; | ||
} | ||
@@ -35,3 +38,3 @@ function processImport(el, tagData) { | ||
// Set the viewModel to the promise | ||
canData.set.call(el, "viewModel", importPromise); | ||
setViewModel(el, importPromise); | ||
canData.set.call(el, "scope", importPromise); | ||
@@ -60,3 +63,3 @@ | ||
canData.set.call(el, "viewModel", importPromise); | ||
setViewModel(el, importPromise); | ||
canData.set.call(el, "scope", importPromise); | ||
@@ -73,9 +76,11 @@ } | ||
nodeList.expression = "<" + this.tagName + ">"; | ||
var removedHandler = function(){ | ||
domEvents.removeEventListener.call(el, "removed", removedHandler); | ||
nodeLists.unregister(nodeList); | ||
}; | ||
domEvents.addEventListener.call(el, "removed", removedHandler); | ||
mutate.appendChild.call(el, frag); | ||
var removalDisposal = domMutate.onNodeRemoval(el, function () { | ||
if (!el.ownerDocument.contains(el)) { | ||
removalDisposal(); | ||
nodeLists.unregister(nodeList); | ||
} | ||
}); | ||
domMutateNode.appendChild.call(el, frag); | ||
nodeLists.update(nodeList, getChildNodes(el)); | ||
@@ -82,0 +87,0 @@ } |
@@ -158,5 +158,11 @@ var SimpleMap = require('can-simple-map'); | ||
var finishWarningCheck = testHelpers.dev.willWarn(/is not in the current scope/, function(message, matched) { | ||
QUnit.notOk(matched, "importPromise throws a false-positive warning (#83)"); | ||
}); | ||
stache.async(template).then(function(renderer){ | ||
var frag = renderer(new SimpleMap()); | ||
finishWarningCheck(); | ||
importer("can-view-import/test/other.stache").then(function(){ | ||
@@ -163,0 +169,0 @@ ok(frag.childNodes[0].childNodes.length > 1, "Something besides a text node is inserted"); |
@@ -38,3 +38,3 @@ var assign = require('can-assign'); | ||
// Set the scope | ||
var scope = tagData.scope.add(importPromise); | ||
var scope = tagData.scope.add(importPromise, { notContext: true }); | ||
@@ -41,0 +41,0 @@ // If there is a can-tag present we will hand-off rendering to that tag. |
{ | ||
"_from": "can-view-import@^4.0.0-pre.3", | ||
"_id": "can-view-import@4.0.0-pre.7", | ||
"_id": "can-view-import@4.0.0-pre.8", | ||
"_inBundle": false, | ||
"_integrity": "sha512-mAYBzUpEct1B2zAj4ndeLTZDHKiuPcIzTZWpGm66OuCgvUE+GseQhLWrAOuIzBuoPVsN51eIlOpAeTXmSZTbYg==", | ||
"_integrity": "sha512-H3msxzevj22JW+l79EHdaMbfPumS42tVGFj06GurTbWLeF7f1Jzgp4Jd4z05a9BV0/kciZFL8475LF/iK6tpmA==", | ||
"_location": "/can-view-import", | ||
@@ -21,4 +21,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "https://registry.npmjs.org/can-view-import/-/can-view-import-4.0.0-pre.7.tgz", | ||
"_shasum": "6642b078ed47c12829d99289a51bd25ac8c9d3f1", | ||
"_resolved": "https://registry.npmjs.org/can-view-import/-/can-view-import-4.0.0-pre.8.tgz", | ||
"_shasum": "3d06bd7fd5ceaf9c234245a7f0516d8b2bfe967d", | ||
"_spec": "can-view-import@^4.0.0-pre.3", | ||
@@ -81,3 +81,3 @@ "_where": "/Library/WebServer/Documents/GitHub/can-view-import/node_modules/steal-stache", | ||
}, | ||
"version": "4.0.0-pre.7" | ||
"version": "4.0.0-pre.8" | ||
} |
{ | ||
"name": "can-view-import", | ||
"version": "4.0.0-pre.8", | ||
"version": "4.0.0-pre.9", | ||
"description": "Import dependencies in CanJS views", | ||
@@ -32,14 +32,16 @@ "homepage": "https://canjs.com/doc/can-view-import.html", | ||
"can-dom-data-state": "^0.2.0", | ||
"can-dom-mutate": "<2.0.0", | ||
"can-globals": "<2.0.0", | ||
"can-log": "^0.1.0", | ||
"can-symbol": "^1.5.0", | ||
"can-util": "^3.9.5", | ||
"can-view-callbacks": "^4.0.0-pre.4", | ||
"can-view-nodelist": "^4.0.0-pre.1" | ||
"can-view-callbacks": "^4.0.0-pre.9", | ||
"can-view-nodelist": "^4.0.0-pre.5" | ||
}, | ||
"devDependencies": { | ||
"bit-docs": "0.0.7", | ||
"can-component": "^4.0.0-pre.12", | ||
"can-component": "^4.0.0-pre.25", | ||
"can-simple-map": "^4.0.0-pre.13", | ||
"can-simple-observable": "^2.0.0-pre.23", | ||
"can-stache": "^4.0.0-pre.21", | ||
"can-stache": "^4.0.0-pre.48", | ||
"can-test-helpers": "^1.0.1", | ||
@@ -46,0 +48,0 @@ "detect-cyclic-packages": "^1.1.0", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
58204
556
0
9
+ Addedcan-dom-mutate@<2.0.0
+ Addedcan-symbol@^1.5.0