antoniop
committed
on 29 Jan 24
Fix selector for the click all list callback
openacs-4/.../www/resources/core.js (+1 -1)
39 39     if (!form) {
40 40         return;
41 41     }
42 42
43 43     //
44 44     // Sometimes is convenient to have a single page serving the
45 45     // purpose of multiple bulk-actions, for instance
46 46     // "do-bulk-stuff?action=1" and "do-bulk-stuff?action=2".
47 47     //
48 48     // To do so, we parse the URL searching for query parameters. If
49 49     // there are, we inject them into the bulk-actions form together
50 50     // with the rest of the request.
51 51     //
52 52     // Note that the variables specified this way have total
53 53     // precedence and will override those specified differently.
54 54     //
55 55
56 56     //
57 57     // Parse the URL
58 58     //
59       const queryString = url.split('?')[1];
  59     const queryString = url.slice(url.indexOf('?') + 1);
60 60     const searchParams = new window.URLSearchParams(queryString);
61 61
62 62     //
63 63     // Cleanup pre-existing variable conflicting with the URL ones
64 64     //
65 65     for (const [name, value] of searchParams) {
66 66         for (const e of form.querySelectorAll(`[name='${name}']`)) {
67 67             //
68 68             // "e" may not be a direct child of the form
69 69             //
70 70             e.remove();
71 71         }
72 72     }
73 73
74 74     //
75 75     // Inject the variables in the form.
76 76     //
77 77     // Note that most browsers now support the "formdata" event, that
78 78     // can be use to manipulate the FormData object directly on the
79 79     // form before this is submitted. However, Safari only introduced