How to use the @aurelia/jit.ReplacePartSymbol function in @aurelia/jit

To help you get started, we’ve selected a few @aurelia/jit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / jit-html / src / template-binder.ts View on Github external
private declareReplacePart(node: HTMLTemplateElement | HTMLElement): ReplacePartSymbol | null {
    const name = node.getAttribute('replace-part');
    if (name == null) {
      const root = this.manifestRoot || this.parentManifestRoot;
      if (root && root.flags & SymbolFlags.isCustomElement /* isCustomElement */ && root.isTarget && root.isContainerless) {
        const physicalNode = root.physicalNode as typeof node;
        if (physicalNode.childElementCount === 1) {
          return new ReplacePartSymbol('default');
        }
      }
      return null;
    }
    return name === '' ? new ReplacePartSymbol('default') : new ReplacePartSymbol(name);
  }
}
github aurelia / aurelia / packages / jit-html / src / template-binder.ts View on Github external
private declareReplacePart(node: HTMLTemplateElement | HTMLElement): ReplacePartSymbol | null {
    const name = node.getAttribute('replace-part');
    if (name == null) {
      const root = this.manifestRoot || this.parentManifestRoot;
      if (root && root.flags & SymbolFlags.isCustomElement /* isCustomElement */ && root.isTarget && root.isContainerless) {
        const physicalNode = root.physicalNode as typeof node;
        if (physicalNode.childElementCount === 1) {
          return new ReplacePartSymbol('default');
        }
      }
      return null;
    }
    return name === '' ? new ReplacePartSymbol('default') : new ReplacePartSymbol(name);
  }
}
github aurelia / aurelia / packages / jit-html / dist / index.es6.js View on Github external
declareReplacePart(node) {
        if (Tracer.enabled) {
            Tracer.enter('TemplateBinder', 'declareReplacePart', slice.call(arguments));
        }
        const name = node.getAttribute('replace-part');
        if (name == null) {
            if (Tracer.enabled) {
                Tracer.leave();
            }
            return null;
        }
        node.removeAttribute('replace-part');
        const symbol = new ReplacePartSymbol(name);
        this.bindChildNodes(node);
        if (Tracer.enabled) {
            Tracer.leave();
        }
        return symbol;
    }
}