本文整理汇总了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;
}