ExtraParameters are swallowed in trigger(click) for checkboxes #4139
Comments
|
Thanks for the report. For some time it didn't work on radios as well but now it does: It required us to revert a fix for #3423 in PR #3581 which is not ideal but, otherwise, we'd have a breaking change. There is an old @gibson042's PR that fixes it (#1367) but it's quite large so we were holding off on accepting it. Since we plan a big event refactor in jQuery 4 that will most likely make more use of the native event system, we need to see how feasible passing data is in this new model so that we don't add it only to revert it shortly thereafter. Am I right in my description of the situation, @dmethvin or @gibson042? Should we leave this issue open until we figure out what the story for jQuery 4 is? This is getting re-reported a lot compared to other issues so people are really running into this frequently. |
|
We can document that it doesn't work, or even deprecate and remove it eventually, but I suspect the people using it have discovered some code snippet elsewhere on the internet that uses it. @minj where/how did you learn about the This is one of those features that I think will prevent us from leaning more heavily on native event plumbing. To get that second argument there has to be some shim between the native handler and the jQuery one. |
|
@dmethvin it is in the docs, of course. I would think people always turn to that first when looking for information, no? One may want to use with a click listener in a completely different JS file, so closure is not always a valid solution. |
Description
It's impossible to pass extraParameters for checkbox click handlers.
Duplicate of #2768
Source of error:
jquery/src/event.js
Line 483 in 7869f83
I did not have time to look into the full history of why this was added but it does not seem right to me. If you want to make sure checked state is set consistently, do so explicitly.
Link to test case
https://jsfiddle.net/xpvt214o/509284/
What do you expect to happen?
"Hello, world" to be displayed, using extraParameters.
What actually happens?
ExtraParameters are discarded.
The text was updated successfully, but these errors were encountered: