Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID of flowchart subgraph SVG element breaks other scripts #4948

Open
mkuo-notion opened this issue Oct 16, 2023 · 0 comments
Open

ID of flowchart subgraph SVG element breaks other scripts #4948

mkuo-notion opened this issue Oct 16, 2023 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@mkuo-notion
Copy link

mkuo-notion commented Oct 16, 2023

Description

A flowchart subgraph is rendered as an SVG <g> elements with the subgraph title as the ID of the element. Because DOM IDs are accessible as a global, this can interfere with/break scripts.

For example

flowchart TD
    subgraph Buffer
        Foo
    end

produces an SVG <g> element with id="Buffer" for the subgraph.

This can break code like

if (Buffer !== undefined) {
  Buffer.doSomething()
}

I realize that in this example, we could also check that typeof Buffer.doSomething === "function", but this check is being done in third party code.

Steps to reproduce

  1. User mermaid to render the following graph
flowchart TD
    subgraph Buffer
        Foo
    end
  1. Create a script that checks for a global and conditionally calls a method if that global exists
if (Buffer !== undefined) {
  Buffer.doSomething()
}

Screenshots

No response

Code Sample

No response

Setup

  • Mermaid version: 10.5.0
  • Browser and Version: all

Suggested Solutions

Additional Context

No response

@mkuo-notion mkuo-notion added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Oct 16, 2023
@jgreywolf jgreywolf added include roadmap items to add to roadmap for auto workflow and removed include roadmap items to add to roadmap for auto workflow labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants