diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/integration/rendering/flowchart.spec.js
index c9e0bad45..4ea4cbcee 100644
--- a/cypress/integration/rendering/flowchart.spec.js
+++ b/cypress/integration/rendering/flowchart.spec.js
@@ -374,6 +374,7 @@ describe('Flowchart', () => {
click B testClick "click test"
classDef someclass fill:#f96;
class A someclass;
+ class C someclass;
`,
{
listUrl: false,
@@ -409,7 +410,9 @@ describe('Flowchart', () => {
click A "index.html#link-clicked" "link test"
click B testClick "click test"
classDef someclass fill:#f96;
- class A someclass;`,
+ class A someclass;
+ class C someclass;
+ `,
{ flowchart: { htmlLabels: false } }
);
});
diff --git a/dist/index.html b/dist/index.html
index fdcf25124..2505d8010 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -289,16 +289,17 @@ graph TB
style 456ac9b0d15a8b7f1e71073221059886 fill:#f9f,stroke:#333,stroke-width:4px
-graph TD
-A[Christmas] -->|Get money| B(Go shopping)
-B --> C{{Let me think...
Do I want something for work,
something to spend every free second with,
or something to get around?}}
-C -->|One| D[Laptop]
-C -->|Two| E[iPhone]
-C -->|Three| F[Car]
-click A "index.html#link-clicked" "link test"
-click B testClick "click test"
-classDef someclass fill:#f96;
-class A someclass;
+ graph TD
+ A[Christmas] -->|Get money| B(Go shopping)
+ B --> C{{Let me think...
Do I want something for work,
something to spend every free second with,
or something to get around?}}
+ C -->|One| D[Laptop]
+ C -->|Two| E[iPhone]
+ C -->|Three| F[Car]
+ click A "index.html#link-clicked" "link test"
+ click B testClick "click test"
+ classDef someclass fill:#f96;
+ class A someclass;
+ class C someclass;
graph TD
@@ -312,6 +313,7 @@ class A someclass;
click B testClick "click test"
classDef someclass fill:#f96;
class A someclass;
+ class C someclass;
graph LR
diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js
index 0d0e971e1..931608b45 100644
--- a/src/diagrams/flowchart/flowRenderer.js
+++ b/src/diagrams/flowchart/flowRenderer.js
@@ -461,6 +461,7 @@ export const draw = function(text, id) {
const node = d3.select('#' + id + ' [id="' + key + '"]');
if (node) {
const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
+ link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');