#10051 closed bug (fixed)
Documentation bug: Inconsistent description of the "thisArg" value among methods that accept a function argument
Reported by: | anonymous | Owned by: | kswedberg |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The documentation for the attr()
method http://api.jquery.com/attr/ states:
function(index, attr) A function returning the value to set. this is the current element. ...
The documentation for the addClass()
method http://api.jquery.com/addClass/ doesn't give any such statement, but shows a code example using this
as an apparent reference to the current element.
$("ul li:last").addClass(function() { return "item-" + $(this).index(); });
The docs for other methods such as append()
and prepend()
that allow a function passed to determine the value set, have no mention whatsoever of this
as a reference to the current DOM element.
If it is jQuery's intention to provide this
as a means of referencing the current DOM element in such functions, then please update the documentation for such methods in order to make it officially supported behavior.
Change History (3)
comment:1 Changed 11 years ago by
Owner: | set to kswedberg |
---|---|
Status: | new → assigned |
comment:2 follow-up: 3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 Changed 11 years ago by
Replying to kswedberg:
Thanks for the ticket. I've updated the documentation. Let me know if there is anything I've missed.
Thank you kswedberg
. I'll take a quick look, but I'd guess you have it covered.
I don't have time to do another bug report right now, so I'm just going to mention it here.
With respect to the jQuery()
function's context
parameter, a selector string is not listed as a valid option. I don't really care about this one, but it was just mentioned on StackOverflow, so I thought I'd let you know.
http://api.jquery.com/jquery/
Thanks again for the quick updates in response to this and the other report 10053
.
patrick
Thanks for the ticket. I've updated the documentation. Let me know if there is anything I've missed.