Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private compilePlainAttribute(symbol: PlainAttributeSymbol): HTMLAttributeInstruction {
if (symbol.command == null) {
if (symbol.expression == null) {
// a plain attribute on a surrogate
return new SetAttributeInstruction(symbol.syntax.rawValue, symbol.syntax.target);
} else {
// a plain attribute with an interpolation
return new InterpolationInstruction(symbol.expression as IInterpolationExpression, symbol.syntax.target);
}
} else {
// a plain attribute with a binding command
return symbol.command.compile(symbol) as HTMLAttributeInstruction;
}
}
private compilePlainAttribute(symbol: PlainAttributeSymbol): HTMLAttributeInstruction {
if (symbol.command == null) {
if (symbol.expression == null) {
// a plain attribute on a surrogate
return new SetAttributeInstruction(symbol.syntax.rawValue, symbol.syntax.target);
} else {
// a plain attribute with an interpolation
return new InterpolationInstruction(symbol.expression as IInterpolationExpression, symbol.syntax.target);
}
} else {
// a plain attribute with a binding command
return symbol.command.compile(symbol) as HTMLAttributeInstruction;
}
}
compilePlainAttribute(symbol) {
if (symbol.command == null) {
if (symbol.expression == null) {
// a plain attribute on a surrogate
return new SetAttributeInstruction(symbol.syntax.rawValue, symbol.syntax.target);
}
else {
// a plain attribute with an interpolation
return new InterpolationInstruction(symbol.expression, symbol.syntax.target);
}
}
else {
// a plain attribute with a binding command
return symbol.command.compile(symbol);
}
}
compileAttribute(symbol) {
if (symbol.command === null) {
const syntax = symbol.syntax;
if (symbol.expression === null) {
const attrRawValue = syntax.rawValue;
if (isOnSurrogate) {
switch (syntax.target) {
case 'class':
return new SetClassAttributeInstruction(attrRawValue);
case 'style':
return new SetStyleAttributeInstruction(attrRawValue);
// todo: define how to merge other attribute peacefully
// this is an existing feature request
}
}
// a plain attribute on a surrogate
return new SetAttributeInstruction(attrRawValue, syntax.target);
}
else {
// a plain attribute with an interpolation
return new InterpolationInstruction(symbol.expression, syntax.target);
}
}
else {
// a plain attribute with a binding command
return symbol.command.compile(symbol);
}
}
// private compileAttribute(symbol: IAttributeSymbol): HTMLAttributeInstruction {
if (symbol.command === null) {
const syntax = symbol.syntax;
if (symbol.expression === null) {
const attrRawValue = syntax.rawValue;
if (isOnSurrogate) {
switch (syntax.target) {
case 'class':
return new runtime_html_1.SetClassAttributeInstruction(attrRawValue);
case 'style':
return new runtime_html_1.SetStyleAttributeInstruction(attrRawValue);
// todo: define how to merge other attribute peacefully
// this is an existing feature request
}
}
// a plain attribute on a surrogate
return new runtime_html_1.SetAttributeInstruction(attrRawValue, syntax.target);
}
else {
// a plain attribute with an interpolation
return new runtime_1.InterpolationInstruction(symbol.expression, syntax.target);
}
}
else {
// a plain attribute with a binding command
return symbol.command.compile(symbol);
}
}
// private compileAttribute(symbol: IAttributeSymbol): HTMLAttributeInstruction {