#10070 closed bug (worksforme)
$(selector, context) documentation clarification
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In the documentation the context in a search has to be:
context A DOM Element, Document, or jQuery to use as context
However, a selector string also seems to work, and people use it that way, e.g.:
$('a', '.container')
The option to use a selector should be included in the documentation, or if that option is unintended and unwanted, an example on how to use a selector as context by creating a jQuery object from it, i.e.:
$('a', $('.container'))
An example where such a use would be plausible:
function getLinks(parentSelector) { return $('a', $(parentSelector)) } getLinks('.container').css('color','red');
Change History (4)
comment:1 Changed 11 years ago by
Keywords: | needsdocs added |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
comment:2 Changed 11 years ago by
If you feel that it should not be supported, why did you close the ticket?
The code does support it, and if that is not desired, it should be changed.
comment:3 Changed 11 years ago by
When I say "encourage and support" I mean in terms of best practices. Yes it works, and I am not advocating we change the behavior. I am simply saying it is a convoluted way of doing something so I would prefer not to encourage it.
That's why the ticket is marked needsdocs
, needing discussion about documentation. There is no change required to the code, so the ticket can be closed and the documentation addressed later.
comment:4 Changed 11 years ago by
Keywords: | needsdocs removed |
---|
People may use it that way, but should we encourage and support it? I don't see a reason to do so.
$(".container a")
is a lot more obvious than$("a", ".container")
.Since it's a docs issue I'll close this ticket and mark it
needsdocs
for later discussion.