MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / insert

Function insert

06.Router/basic/js/vue.js:9161–9178  ·  view source on GitHub ↗

* Shared DOM insertion function. * * @param {Vue} vm * @param {Element} target * @param {Function} [cb] * @param {Boolean} [withTransition] * @param {Function} op1 - op for non-transition insert * @param {Function} op2 - op for transition insert * @return vm

(vm, target, cb, withTransition, op1, op2)

Source from the content-addressed store, hash-verified

9159 */
9160
9161 function insert(vm, target, cb, withTransition, op1, op2) {
9162 target = query(target);
9163 var targetIsDetached = !inDoc(target);
9164 var op = withTransition === false || targetIsDetached ? op1 : op2;
9165 var shouldCallHook = !targetIsDetached && !vm._isAttached && !inDoc(vm.$el);
9166 if (vm._isFragment) {
9167 mapNodeRange(vm._fragmentStart, vm._fragmentEnd, function (node) {
9168 op(node, target, vm);
9169 });
9170 cb && cb();
9171 } else {
9172 op(vm.$el, target, vm, cb);
9173 }
9174 if (shouldCallHook) {
9175 vm._callHook('attached');
9176 }
9177 return vm;
9178 }
9179
9180 /**
9181 * Check for selectors

Callers 1

domAPIFunction · 0.70

Calls 4

queryFunction · 0.70
inDocFunction · 0.70
mapNodeRangeFunction · 0.70
cbFunction · 0.70

Tested by

no test coverage detected