fix: Merkliste-Lösch-Row blieb im DOM — ID-Lookup vs. escAttr inkonsistent
Row-ID wird via escAttr gebildet ([^a-zA-Z0-9_-] → '_'), z.B. '18/18089' landet als id='merkliste-row-18_18089'. Der getElementById-Lookup nutzte aber CSS.escape, das 18/18089 zu 18\\/18089 escaped — zwei verschiedene Strings, getElementById lieferte null, el.remove() lief nicht. Plus: getElementById akzeptiert ohnehin keinen CSS-Selektor — der CSS.escape-Lookup war doppelt falsch. Fix: gleiche Sanitization-Regex wie escAttr im Lookup nutzen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c599e5f6b5
commit
03948038c4
@ -201,7 +201,10 @@
|
||||
try {
|
||||
var r = await fetch('/api/me/merkliste/' + encodeURIComponent(antragId), { method: 'DELETE' });
|
||||
if (r.ok) {
|
||||
var el = document.getElementById('merkliste-row-' + CSS.escape(antragId));
|
||||
// Row-ID wird via escAttr gebildet (alphanumerisch + Unterstrich) —
|
||||
// gleiche Sanitization für den Lookup, sonst findet getElementById nichts.
|
||||
var rowId = 'merkliste-row-' + String(antragId || '').replace(/[^a-zA-Z0-9_-]/g, '_');
|
||||
var el = document.getElementById(rowId);
|
||||
if (el) el.remove();
|
||||
if (!resultsEl.querySelectorAll('.merkliste-entry').length) {
|
||||
emptyEl.style.display = '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user