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

graph.js will crash if there's a node named hasOwnProperty #200

Closed
ddadamhooper opened this issue Aug 2, 2024 · 1 comment
Closed

graph.js will crash if there's a node named hasOwnProperty #200

ddadamhooper opened this issue Aug 2, 2024 · 1 comment

Comments

@ddadamhooper
Copy link

ddadamhooper commented Aug 2, 2024

The bug is pretty clear: a node named hasOwnProperty will make the this._nodes.hasOwnProperty(...) calls fail.

if (this._nodes.hasOwnProperty(v)) {

As seen in this little big of JS trivia:

const _nodes = { hasOwnProperty: "hi" };
_nodes.hasOwnProperty("anything"); // Uncaught TypeError: _nodes.hasOwnProperty is not a function

Fix: should be Object.hasOwn(this._nodes, ...). See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn#problematic_cases_for_hasownproperty

@rustedgrail
Copy link
Collaborator

Fixing this here and in Dagre

#202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants