Skip to content

Commit

Permalink
fix: avoid direct assignment of innerHTML for Advanced Marker-based c…
Browse files Browse the repository at this point in the history
…luster pins (#744)
  • Loading branch information
sandeepk-e authored Sep 11, 2023
1 parent 0d26640 commit de1ef27
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ export class DefaultRenderer implements Renderer {

if (MarkerUtils.isAdvancedMarkerAvailable(map)) {
// create cluster SVG element
const div = document.createElement("div");
div.innerHTML = svg;
const svgEl = div.firstElementChild;
const parser = new DOMParser();
const svgEl = parser.parseFromString(
svg,
"image/svg+xml"
).documentElement;
svgEl.setAttribute("transform", "translate(0 25)");

const clusterOptions: google.maps.marker.AdvancedMarkerElementOptions = {
Expand Down

0 comments on commit de1ef27

Please sign in to comment.