本文整理匯總了TypeScript中@utils/refs._document類的典型用法代碼示例。如果您正苦於以下問題:TypeScript _document類的具體用法?TypeScript _document怎麽用?TypeScript _document使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了_document類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
_build: function(node, model, ctx, component) {
var fragment = _document.createDocumentFragment();
build(node.nodes, model, ctx, fragment, component);
return fragment;
}
示例2: _renderPlaceholder
export function _renderPlaceholder(staticCompo, compo, container) {
var placeholder = staticCompo.placeholder;
if (placeholder == null) {
placeholder = _document.createComment('');
container.appendChild(placeholder);
}
compo.placeholder = placeholder;
}
示例3: function
nodeRenderStart: function(expr, model, ctx, el, ctr, type, node){
var current = expression_eval_safe(expr, model, ctx, ctr, node);
// though we apply value's to `this` context, but it is only for immediat use
// in .node() function, as `this` context is a static object that share all bind
// utils
this.element = _document.createTextNode(current);
return (this.current = current);
},
示例4: 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);
};
示例5: 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);
};
示例6: 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);
},
示例7: el_renderPlaceholder
export function el_renderPlaceholder (container) {
let anchor = _document.createComment('');
container.appendChild(anchor);
return anchor;
}