Conversation
…ndler
graph.js builds a class from a galaxy name and looks it up with a selector
built the same way, replacing only whitespace and ".":
d3.selectAll(".legend-text.galaxy-" + d.galaxy.replace(/\s+/g,'-').replace(/[\s.]/g,'-'))
A class selector may only contain [A-Za-z0-9_-]; querySelectorAll throws a
DOMException on anything else and aborts the calling handler. 17 of the 131
galaxy names hit this -- 15 contain "&" (every "MITRE ATT&CK *" galaxy), one
"()" and one "/" -- so node mouseover, legend emphasis and link
highlighting are all dead for exactly the busiest galaxies.
Add one galaxyClass() helper replacing every character outside
[A-Za-z0-9_-], used at all six sites (three that assign the class, three
that select on it) so the two cannot drift apart.
All 131 names are ASCII and no stylesheet hardcodes these classes, so the
rename affects nothing else.
Verified: 17 invalid selectors -> 0; node --check passes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HZGwPoa8MMfkhCw47rDLA4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF —
graph.jsmouseover throws for every MITRE ATT&CK galaxy because the CSS selector is invalidgraph.jsbuilds a CSS class from a galaxy name with an expression that only strips whitespace and dots, then queries with the same expression, so any other character goes into the selector raw anddocument.querySelectorAllthrows aDOMExceptionthat aborts the mouseover handler. 17 of the 131 galaxy names hit this, including every MITRE ATT&CK galaxy (the ampersand), plus names containing parentheses and a slash.galaxyClass()helper replacing every character outside[A-Za-z0-9_-], used at all six assign and select sites so the two cannot drift.Problem
graph.jsbuilds a CSS class from a galaxy name and later looks it up with a selector built the same way — six sites, all carrying a copy of the same expression:Only whitespace and
.are replaced. Everything else goes into the selector untouched, and a class selector may only contain[A-Za-z0-9_-](plus non-ASCII and escapes).document.querySelectorAllthrows aDOMExceptionon anything else, which aborts the handler that called it.17 of the 131 galaxy names produce an invalid selector — including every
MITRE ATT&CK *galaxy:15 names contain
&, one contains(), one contains/. Hovering a node in any of those galaxies throws, so the mouseover highlight, the legend emphasis and the link highlighting all stop working for exactly the galaxies people use most.Fix
One
galaxyClass()helper that replaces every character outside[A-Za-z0-9_-], used at all six sites — the three that assign the class and the three that select on it — so the two can no longer drift apart.All 131 galaxy names are ASCII (checked), so no non-ASCII identifiers are being flattened, and no stylesheet hardcodes these class names (
grep -rn "galaxy-" stylesheets/is empty), so renaming them affects nothing else.Verification
node --check graph.jspasses, and no hand-rolled copy of the expression remains in the file.🤖 Generated with Claude Code