本文整理匯總了TypeScript中@utils/refs._document.createDocumentFragment方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript _document.createDocumentFragment方法的具體用法?TypeScript _document.createDocumentFragment怎麽用?TypeScript _document.createDocumentFragment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@utils/refs._document
的用法示例。
在下文中一共展示了_document.createDocumentFragment方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
_build: function(node, model, ctx, component) {
var fragment = _document.createDocumentFragment();
build(node.nodes, model, ctx, fragment, component);
return fragment;
}
示例2: compo_renderChildren
export function compo_renderChildren (compo, anchor, model?){
var fragment = _document.createDocumentFragment();
compo.elements = compo_renderElements(
compo.nodes,
model || compo.model,
compo.ctx,
fragment,
compo
);
dom_insertBefore(fragment, anchor);
compo_inserted(compo);
};
示例3: list_sort
export function list_sort (self, array){
var compos = self.node.components,
i = 0,
imax = compos.length,
j = 0,
jmax = null,
element = null,
compo = null,
fragment = _document.createDocumentFragment(),
sorted = [];
for (; i < imax; i++) {
compo = compos[i];
if (compo.elements == null || compo.elements.length === 0)
continue;
for (j = 0, jmax = compo.elements.length; j < jmax; j++) {
element = compo.elements[j];
element.parentNode.removeChild(element);
}
}
outer: for (j = 0, jmax = array.length; j < jmax; j++) {
for (i = 0; i < imax; i++) {
if (array[j] === self._getModel(compos[i])) {
sorted[j] = compos[i];
continue outer;
}
}
console.warn('No Model Found for', array[j]);
}
for (i = 0, imax = sorted.length; i < imax; i++) {
compo = sorted[i];
if (compo.elements == null || compo.elements.length === 0) {
continue;
}
for (j = 0, jmax = compo.elements.length; j < jmax; j++) {
element = compo.elements[j];
fragment.appendChild(element);
}
}
self.components = self.node.components = sorted;
dom_insertBefore(fragment, self.placeholder);
};
示例4: function
refresh: function() {
var currentIndex = this.index,
model = this.model,
ctx = this.ctx,
ctr = this.controller,
switch_ = this.Switch,
imax = switch_.length,
i = -1;
while ( ++i < imax ){
var node = switch_[i].node;
var expr = node.expression;
if (expr == null)
break;
if (expression_eval_safe(expr, model, ctx, ctr, node))
break;
}
if (currentIndex === i)
return;
if (currentIndex != null)
els_toggleVisibility(switch_[currentIndex].elements, false);
if (i === imax) {
this.index = null;
return;
}
this.index = i;
var current = switch_[i];
if (current.elements != null) {
els_toggleVisibility(current.elements, true);
return;
}
var nodes = current.node.nodes,
frag = _document.createDocumentFragment(),
owner = { components: [], parent: ctr },
els = compo_renderElements(nodes, model, ctx, frag, owner);
dom_insertBefore(frag, this.placeholder);
current.elements = els;
compo_inserted(owner);
if (ctr.components == null) {
ctr.components = [];
}
ctr.components.push.apply(ctr.components, owner.components);
},