MCPcopy Create free account
hub / github.com/angular/angular / applyTAttributes

Function applyTAttributes

packages/core/test/render3/instructions/styling_spec.ts:556–574  ·  view source on GitHub ↗
(attrs: TAttributes | null)

Source from the content-addressed store, hash-verified

554}
555
556function applyTAttributes(attrs: TAttributes | null) {
557 if (attrs === null) return;
558 const div: HTMLElement = getLView()[HEADER_OFFSET];
559 let mode: AttributeMarker = AttributeMarker.ImplicitAttributes;
560 for (let i = 0; i < attrs.length; i++) {
561 const item = attrs[i];
562 if (typeof item === 'number') {
563 mode = item;
564 } else if (typeof item === 'string') {
565 if (mode == AttributeMarker.ImplicitAttributes) {
566 div.setAttribute(item, attrs[++i] as string);
567 } else if (mode == AttributeMarker.Classes) {
568 div.classList.add(item);
569 } else if (mode == AttributeMarker.Styles) {
570 div.style.setProperty(item, attrs[++i] as string);
571 }
572 }
573 }
574}
575
576function activateHostBindings(directiveIndex: number) {
577 const bindingRootIndex = getBindingRootIndexFromDirectiveIndex(directiveIndex);

Callers 2

givenTemplateAttrsFunction · 0.85
givenDirectiveAttrsFunction · 0.85

Calls 4

getLViewFunction · 0.90
setAttributeMethod · 0.65
addMethod · 0.65
setPropertyMethod · 0.65

Tested by

no test coverage detected