-
Notifications
You must be signed in to change notification settings - Fork 264
Correct documentation of callback arguments #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm not sure if that second argument to that callback was defined before 2.x. We could bring the 1.x up to compatibility, but I think we'd want to document the minimum supported version(s) for the second argument if it is currently missing in 1.x branch. |
Thanks, Corey! I'd be happy to update the patch to accomodate, but it sounds like we need to verify that this is new to 2.x . @esx introduced the documentation for the second argument in January of this year. @tjvantoll do you know if this is new to jQuery 2.x ? If so, how would you like me to denote this argument as "2.x and up" in this patch? |
I'm not seeing any difference in the behavior of 1.x and 2.x—http://jsfiddle.net/tj_vantoll/gs32f3m0/. I think it makes sense to add this mention of the second argument, although I would use “HTML contents” to refer to its value rather than “old HTML value”. |
It works in jQuery 1.10 (http://jsfiddle.net/gnarf/gs32f3m0/2/) but not 1.9(http://jsfiddle.net/gnarf/gs32f3m0/3/) |
@kswedberg - do you know how we can document that the second argument to this callback is only present in jQuery 1.10+ / jQuery 2.0+ ? |
Remove the second argument from the existing signature and add a new signature with the correct version in the |
yeah, 👍 to what @scottgonzalez said. The new signature should have |
@tjvantoll I copied that wording from the equivalent documentation on |
Since jQuery version 1.10, `$.fn.after` invokes the supplied function with two arguments: the numeric index of each element in the set and the string markup describing each element's contents. Remove the second argument from the documentation of the pre-1.10 signature and add a new entry to thoroughly document the post-1.10 signature.
Since jQuery version 1.10, `$.fn.before` invokes the supplied function with two arguments: the numeric index of each element in the set and the string markup describing each element's contents. Remove the second argument from the documentation of the pre-1.10 signature and add a new entry to thoroughly document the post-1.10 signature.
d8b7f99
to
82ebb27
Compare
@kswedberg @scottgonzalez Thanks to you both! I've updated the patch according to your feedback and split it into two commits (one for each method). I have not verified the output by building the site myself, though--would one of the maintainers mind doing this on my behalf? |
I feel like this should maybe be before the other signature (or maybe it doesn't matter shrug) |
Looks good to me, @jugglinmike. I pulled it and tested a build with no problems. Will merge shortly. Thanks! |
My pleasure :) |
The described behavior is implemented by jQuery 2.x but not jQuery 1.x. I think this is a bug because the documentation already describes the argument type for these callback functions: see
$.fn.after
and$.fn.before
. If a maintainer could confirm this, I'd be happy to follow up with a patch for jQuery 1.x.Commit message: