@endeavorance/quill
    Preparing search index...

    Function setAttribute

    • Intelligently set an attribute on an HTMLElement

      Type Parameters

      • T = unknown

      Parameters

      • $el: Element

        The HTMLElement to set an attribute on

      • name: string

        The name of the attribute to set

      • val: T

        A value to set as the attribute

      Returns void

      The behavior of this function is based on the type of val being set.

      • Strings: Sets as-is
      • null, or false: Removes the attribute if it exists
      • true: Sets the attribute as an empty string
      • Other: Serializes with JSON.stringify and sets as a string