diff --git a/cypress/integration/other/interaction.spec.js b/cypress/integration/other/interaction.spec.js index cfd937e63..6d37af273 100644 --- a/cypress/integration/other/interaction.spec.js +++ b/cypress/integration/other/interaction.spec.js @@ -16,7 +16,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); @@ -38,7 +38,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-2URL') + .find('g[id="2URL"]') .click(); cy.location().should(location => { @@ -108,7 +108,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); @@ -130,7 +130,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-2URL') + .find('g[id="2URL"]') .click(); cy.location().should(location => { @@ -200,7 +200,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); diff --git a/src/diagrams/flowchart/flowDb.js b/src/diagrams/flowchart/flowDb.js index abe922bbc..7686d0421 100644 --- a/src/diagrams/flowchart/flowDb.js +++ b/src/diagrams/flowchart/flowDb.js @@ -4,7 +4,8 @@ import { logger } from '../../logger'; import utils from '../../utils'; import { getConfig } from '../../config'; -const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-'; +// const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-'; +const MERMAID_DOM_ID_PREFIX = ''; const config = getConfig(); let vertices = {}; diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index fac20a742..473d1398c 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -460,8 +460,8 @@ export const draw = function(text, id) { subG = subGraphs[i]; if (subG.title !== 'undefined') { - const clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect'); - const clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id); + const clusterRects = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"] rect'); + const clusterEl = document.querySelectorAll('#' + id + ' [id="' + subG.id + '"]'); const xPos = clusterRects[0].x.baseVal.value; const yPos = clusterRects[0].y.baseVal.value; @@ -475,7 +475,7 @@ export const draw = function(text, id) { // Add label rects for non html labels if (!conf.htmlLabels) { - const labels = document.querySelectorAll('#' + id + ' .edgeLabel .label'); + const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label'); for (let k = 0; k < labels.length; k++) { const label = labels[k];