wdpr
    Preparing search index...

    Function sanitizeAttributes

    • Sanitize a map of HTML attributes, returning a new map containing only entries that pass all safety checks.

      For each attribute, this function:

      1. Drops attributes that fail isSafeAttribute (event handlers, unknown names)
      2. Drops URL-bearing attributes whose values fail isDangerousUrl
      3. Sanitizes style values via sanitizeStyleValue, dropping them entirely if the result is empty
      4. Passes all other safe attributes through unchanged

      Parameters

      • attributes: Record<string, string>

        The raw attribute name-value map to sanitize.

      Returns Record<string, string>

      A new map containing only the safe attributes and their (possibly sanitized) values.