refactor(ivy): define new AttributeMarker.Template
marker (#29041)
This commit adds a new `AttributeMarker` type that will be used, in a future commit, to mark attributes as coming from an inline-template expansion, rather than the element that is being contained in the template. PR Close #29041
This commit is contained in:

committed by
Kara Erickson

parent
423ac01dcf
commit
e3a401d20c
@ -17,7 +17,7 @@ import {getComponentDef, getDirectiveDef, getPipeDef} from './definition';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {NO_PARENT_INJECTOR, NodeInjectorFactory, PARENT_INJECTOR, RelativeInjectorLocation, RelativeInjectorLocationFlags, TNODE, isFactory} from './interfaces/injector';
|
||||
import {AttributeMarker, TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeProviderIndexes, TNodeType} from './interfaces/node';
|
||||
import {TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeProviderIndexes, TNodeType, isNameOnlyAttributeMarker} from './interfaces/node';
|
||||
import {DECLARATION_VIEW, INJECTOR, LView, TData, TVIEW, TView, T_HOST} from './interfaces/view';
|
||||
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||
import {getLView, getPreviousOrParentTNode, setTNodeAndViewData} from './state';
|
||||
@ -272,9 +272,10 @@ export function injectAttributeImpl(tNode: TNode, attrNameToInject: string): str
|
||||
if (attrs) {
|
||||
for (let i = 0; i < attrs.length; i = i + 2) {
|
||||
const attrName = attrs[i];
|
||||
if (attrName === AttributeMarker.Bindings) break;
|
||||
// TODO: What happens here if an attribute has a namespace?
|
||||
// TODO: What happens here if the attribute name happens to match a CSS class or style?
|
||||
// If we hit a `Bindings` or `Template` marker then we are done.
|
||||
if (isNameOnlyAttributeMarker(attrName)) break;
|
||||
// TODO(FW-1137): Skip namespaced attributes
|
||||
// TODO(FW-1139): supports classes/styles in @Attribute injection
|
||||
if (attrName == attrNameToInject) {
|
||||
return attrs[i + 1] as string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user