mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix flowchart tooltip typing
Tooltip is an object that gets reset to an array. It is then looked up for properties without guard, causing array functions like "length" and "constructor" to run into undefined behvaior.
This commit is contained in:
parent
8066d94c1d
commit
0cab66c9d8
@ -342,7 +342,8 @@ export const setLink = function (ids, linkStr, target) {
|
||||
setClass(ids, 'clickable');
|
||||
};
|
||||
export const getTooltip = function (id) {
|
||||
return tooltips[id];
|
||||
if (tooltips.hasOwnProperty(id)) return tooltips[id];
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -443,7 +444,7 @@ export const clear = function (ver = 'gen-1') {
|
||||
subGraphs = [];
|
||||
subGraphLookup = {};
|
||||
subCount = 0;
|
||||
tooltips = [];
|
||||
tooltips = {};
|
||||
firstGraphFlag = true;
|
||||
version = ver;
|
||||
commonClear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user