All issues identified in plans/analysis-v131.md. Build ✅ | Tests ✅ (1377 passed, 0 failed)
File: js/components/suggest.js
- Added
_escapeHtml()helper inside the IIFE renderItems()now escapes text before applying the highlight regex viainnerHTML- Previously, raw server/user data was inserted directly — a malicious suggestion like
<img src=x onerror=alert(1)>would execute
File: js/components/select.js
- Fixed 3 querySelector calls using
.vd-custom-select-optionto match the actual class.custom-select-option - Affected:
updateSelectedOptions(),openDropdown(),handleKeydown() - Previously: keyboard navigation and programmatic updates silently failed
File: js/components/select.js
generateId()now assigns the generated ID toelement.idbefore returning- Previously: ARIA
aria-labelledbypointed to a nonexistent ID
File: js/components/code-snippet.js
codesnippet:copyevent now passes the actualcopySuccessresult instead of hardcodedtrue
File: js/components/modals.js
- Replaced per-modal
document.addEventListener('keydown', ...)with a single shared handler - Shared handler installed on first modal init, removed on
destroyAll() - Eliminates redundant event processing on pages with many modals
Files: js/components/dropdown.js, js/components/select.js
- Moved
_typeaheadBufferand_typeaheadTimerfrom module-level to per-instance state - Stored in the
instancesMap alongside cleanup functions - Previously: typing in one dropdown corrupted the typeahead state of another
Files: js/components/navbar.js, css/components/navbar.css
- Replaced
document.body.style.overflow = 'hidden'with CSS classbody-navbar-open - Added
.body-navbar-open { overflow: hidden; }to navbar.css - Prevents navbar and modal scroll locks from clobbering each other
File: js/utils/helpers.js
on()now returns the actual bound wrapper function for delegation- Callers can pass the return value to
off()to remove delegation listeners - Direct event bindings also return the handler for consistency
File: js/components/validate.js
- Added 100-character length limit on user-supplied regex patterns
- Prevents catastrophic backtracking from excessively complex patterns
File: js/components/validate.js
matchrule now usesCSS.escape()on theparambefore building the querySelector- Wrapped in try/catch to handle invalid selectors gracefully
File: js/components/image-box.js
- Replaced DOM0
this.img.onload = ...withaddEventListener('load', ..., { once: true }) - Clean up handler in
close()if image hasn't loaded yet
File: js/components/theme-customizer.js
- Removed redundant second
this.applyTheme(this.DEFAULTS.THEME)call inreset()
- Renaming
$/$$tovd$/vd$$is a breaking API change affecting all consumers - Deferred for a major version discussion
| File | Fixes |
|---|---|
js/components/suggest.js |
#1 |
js/components/select.js |
#4, #5, #6 |
js/components/code-snippet.js |
#2 |
js/components/dropdown.js |
#4 |
js/components/modals.js |
#3 |
js/components/navbar.js |
#7 |
css/components/navbar.css |
#7 |
js/utils/helpers.js |
#11 |
js/components/validate.js |
#13, #14 |
js/components/image-box.js |
#9 |
js/components/theme-customizer.js |
#12 |