GeoLeaf Core API - v3.19.0
    Preparing search index...

    Function sanitizeAttribution

    • Cleans a map credit for the engine's attribution control.

      Keeps text, inline formatting and links whose URL validateUrl accepts (a kept link opens in a new tab, rel="noopener noreferrer"); every other element becomes its text, and attributes other than a link's are dropped. Without a DOM there is no attribution control to fill, and the credit is "".

      Parameters

      • html: string

        The credit as declared — HTML allowed.

      Returns string

      The cleaned credit, or "" when there is nothing to show.

      sanitizeAttribution('© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>');
      // '© <a href="https://www.openstreetmap.org/copyright" rel="noopener noreferrer" target="_blank">OpenStreetMap</a>'