How to use can-dom-mutate - 2 common examples

To help you get started, we’ve selected a few can-dom-mutate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github canjs / can-connect / can / tag / tag.js View on Github external
el[canSymbol.for('can.viewModel')] = request;

		var nodeList = nodeLists.register([], undefined, tagData.parentNodeList || true);

		var frag = tagData.subtemplate ?
					tagData.subtemplate( tagData.scope.add(request), tagData.options, nodeList ) :
					document.createDocumentFragment();

		// Append the resulting document fragment to the element
		domMutateNode.appendChild.call(el, frag);

		// update the nodeList with the new children so the mapping gets applied
		nodeLists.update(nodeList, el.childNodes);

		var removalDisposal = domMutate.onNodeRemoval(el, function () {
			if (!el.ownerDocument.contains(el)) {
				removalDisposal();
				nodeLists.unregister(nodeList);
			}
		});
	});
};
github canjs / can-connect / can / tag / tag.js View on Github external
var promise = connection[method](hash);
			addToPageData(hash, promise);
			return promise;
		});

		el[canSymbol.for('can.viewModel')] = request;

		var nodeList = nodeLists.register([], undefined, tagData.parentNodeList || true);

		var frag = tagData.subtemplate ?
					tagData.subtemplate( tagData.scope.add(request), tagData.options, nodeList ) :
					document.createDocumentFragment();

		// Append the resulting document fragment to the element
		domMutateNode.appendChild.call(el, frag);

		// update the nodeList with the new children so the mapping gets applied
		nodeLists.update(nodeList, el.childNodes);

		var removalDisposal = domMutate.onNodeRemoval(el, function () {
			if (!el.ownerDocument.contains(el)) {
				removalDisposal();
				nodeLists.unregister(nodeList);
			}
		});
	});
};

can-dom-mutate

Dispatch and listen for DOM mutations

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis