diff --git a/classes/mapworker.php b/classes/mapworker.php index dda46c8d..d7bf5574 100644 --- a/classes/mapworker.php +++ b/classes/mapworker.php @@ -265,6 +265,7 @@ public function process_map_objects(): void { } else { $this->svgmap->set_hidden($links[$place]); $this->svgmap->remove_link($links[$place]); + $this->svgmap->remove_attribute($links[$place], 'data-cmid'); } } // Remove all places that are impossible to reach. diff --git a/classes/svgmap.php b/classes/svgmap.php index 6f203b8b..14f97942 100644 --- a/classes/svgmap.php +++ b/classes/svgmap.php @@ -535,6 +535,20 @@ public function set_attribute(string $id, string $attribute, string $value): voi } } + /** + * Removes an attribute of an element. + * + * @param string $id The id of the DOM element + * @param string $attribute The name of the attribute + * @return void + */ + public function remove_attribute(string $id, string $attribute): void { + $element = $this->get_element_by_id($id); + if ($element) { + $element->removeAttribute($attribute); + } + } + /** * Replaces all CDATA sections with properly escaped content *