Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
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);
}
}
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;
}
}