Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection of helpful utilities

// esm
import { utils } from '@paychex/platform-browser';

// cjs
const { utils } = require('@paychex/platform-browser');

// iife
const { utils } = window['@paychex/platform-browser'];

// amd
require(['@paychex/platform-browser'], function({ utils }) { ... });
define(['@paychex/platform-browser'], function({ utils }) { ... });

Index

Functions

  • ensureUniqueIds(svg: string): string
  • The svgId utility function processes a svg element as a string and ensures that the ids within are unique. If there are multiple of the same inline SVGs that have elements in the block with linked IDs to those symbols, this will assist in a11y compliance by making those IDs unique.

    example
    var svgElement = document.getElementById("some-id");
    var modifiedSvgElement = utils.ensureUniqueIds(svgElement.outerHTML);

    Parameters

    • svg: string

      The SVG that should have unique IDs created

    Returns string

    An SVG element with unique IDs