aeonframework opened a new pull request, #1728: URL: https://github.com/apache/wicket/pull/1728
Backport of #1667 to `wicket-10.x`, as asked in the review there. Resolves [WICKET-6938](https://issues.apache.org/jira/browse/WICKET-6938) on 10.x. Same change as #1667, see there for the problem and the approach: 1. **ChoiceFilter** registers its auto-submit handler with an `OnEventHeaderItem` instead of an inline `onchange`, so it carries the CSP nonce. Cherry-picked cleanly. 2. **Autocomplete** dispatches a cancelable, bubbling `wicket-autocomplete-select` event instead of running `getOnSelectJavaScriptExpression` with `eval()`. Data for listeners comes from the new `AbstractAutoCompleteRenderer#getChoiceData` (`@since 10.12.0`). `getOnSelectJavaScriptExpression` is `@Deprecated(since = "10.12.0", forRemoval = true)` and keeps working where `'unsafe-eval'` is allowed; if it throws (for example because the CSP blocks `eval()`), the error is logged with `Wicket.Log.error` and the text value is used. Followed by the review fixes from #1667: the `10.12.0` version, the Javadoc on registering a listener that survives Ajax re-rendering (also on `AutoCompleteTextField` and `AutoCompleteBehavior`), the empty-value note, the `dataset` camelCase note, and the `eval()` error fallback. Differences from the master commits: - `wicket-autocomplete.js`: `handleSelection` uses `var`, like the rest of the file on 10.x. - `Gruntfile.js`: 10.x has no vanilla engine, so `autocomplete.html` runs in `qunit:all` against jQuery 4.0.0 and 3.7.1, and `autocomplete.html` loads jQuery and `wicket-ajax-jquery.js` only. - `JAVASCRIPTTESTING.md` does not exist on 10.x, so that hunk is dropped. The change is binary compatible: one protected method added to `AbstractAutoCompleteRenderer`, one deprecated. japicmp against 10.0.0 passes. ### Tests (JDK 21) - `mvn -pl wicket-extensions clean test -Dtest=AutoCompleteTest,AbstractAutoCompleteRendererTest,ChoiceFilterTest,FilterFormTest`: 9/9 pass. - `mvn -pl wicket-extensions clean verify -DskipTests` (japicmp) and `javadoc:javadoc`: clean. - `mvn -pl testing/wicket-js-tests -Pjs-test test`: jshint clean, QUnit 240/240, including the 5 autocomplete tests on both jQuery versions. This change was prepared with AI assistance and reviewed and tested by me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
