本文整理汇总了TypeScript中@aurelia/jit.ResourceModel.getElementInfo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ResourceModel.getElementInfo方法的具体用法?TypeScript ResourceModel.getElementInfo怎么用?TypeScript ResourceModel.getElementInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@aurelia/jit.ResourceModel
的用法示例。
在下文中一共展示了ResourceModel.getElementInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bindManifest
private bindManifest(parentManifest: IElementSymbol, node: HTMLTemplateElement | HTMLElement): void {
if (Tracer.enabled) { Tracer.enter('TemplateBinder', 'bindManifest', slice.call(arguments)); }
switch (node.nodeName) {
case 'LET':
// let cannot have children and has some different processing rules, so return early
this.bindLetElement(parentManifest, node);
if (Tracer.enabled) { Tracer.leave(); }
return;
case 'SLOT':
// slot requires no compilation
this.surrogate.hasSlots = true;
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// nodes are processed bottom-up so we need to store the manifests before traversing down and
// restore them again afterwards
const parentManifestRootSave = this.parentManifestRoot;
const manifestRootSave = this.manifestRoot;
const manifestSave = this.manifest;
// get the part name to override the name of the compiled definition
this.partName = node.getAttribute('part');
let manifestRoot: CustomElementSymbol;
let name = node.getAttribute('as-element');
if (name === null) {
name = node.nodeName.toLowerCase();
}
const elementInfo = this.resources.getElementInfo(name);
if (elementInfo === null) {
// there is no registered custom element with this name
this.manifest = new PlainElementSymbol(node);
} else {
// it's a custom element so we set the manifestRoot as well (for storing replace-parts)
this.parentManifestRoot = this.manifestRoot;
manifestRoot = this.manifestRoot = this.manifest = new CustomElementSymbol(this.dom, node, elementInfo);
}
// lifting operations done by template controllers and replace-parts effectively unlink the nodes, so start at the bottom
this.bindChildNodes(node);
// the parentManifest will receive either the direct child nodes, or the template controllers / replace-parts
// wrapping them
this.bindAttributes(node, parentManifest);
if (manifestRoot !== undefined && manifestRoot.isContainerless) {
node.parentNode.replaceChild(manifestRoot.marker as Node, node);
} else if (this.manifest.isTarget) {
node.classList.add('au');
}
// restore the stored manifests so the attributes are processed on the correct lavel
this.parentManifestRoot = parentManifestRootSave;
this.manifestRoot = manifestRootSave;
this.manifest = manifestSave;
if (Tracer.enabled) { Tracer.leave(); }
}