@haiix/tcomponent
    Preparing search index...

    Function applyParams

    • Applies component parameters (attributes and child nodes) to a specific target DOM element. This utility drastically simplifies routing "Props" (attributes) and "Slots" (childNodes) to either the component's root element or a specific internal element.

      It smartly handles merging of class and style attributes, and safely ignores internal attributes like id and on*.

      Parameters

      • component: TComponent

        The current component instance.

      • target: Element

        The DOM element to receive the attributes and children.

      • params: ComponentParams

        The ComponentParams object containing attributes and childNodes.

      Returns void

      class Card extends TComponent<HTMLDivElement> {
      static template = `<div class="card"><div id="body"></div></div>`;
      constructor(params: ComponentParams) {
      super(params);
      // Inject props and slots into the internal body element
      applyParams(this, this.idMap['body'], params);
      }
      }