Assuming I have
<div id="scope"><p class="awesome">awesome</p></div>
the following queries, which seem from inspection to be equivalent, return inconsistent things:
dojo.query("#notThere .awesome");
// |
// \-> yields zero elements
dojo.query(".awesome", "notThere");
// |
// \-> yields one element
The varying behavior is due to dojo.query taking the second argument, passing it through dojo.byId and then taking the null return to mean that the user called dojo.query like this:
dojo.query(".awesome", null);
// which is equivalent to
dojo.query(".awesome");
I suggest possibly returning zero elements if the second parameter is null and only defaulting to searching the entire document if the second parameter is undefined. This would have a backwards-compat impact, but I feel that the current behavior is a bug.
as per today's meeting, punting these core bugs