Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#7368 closed defect (fixed)

dojo.query throws TypeError on some not-found queries

Reported by: bitranch Owned by: alex
Priority: high Milestone: 1.3
Component: Query Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description

This is with svn trunk as of this morning.

When an id isn't in the document, equivalent queries have very different results. For example, this query returns an empty NodeList:

dojo.query("#domaindata");

This query throws TypeError: elem is null:

dojo.query("div#domaindata");

The error is in dojo/_base/query.js line 789 in getSimpleFilterFunc(). It looks like the test is assuming an element exists even though the result set is empty.

Attachments (1)

query4.js.diff (480 bytes) - added by nic 10 years ago.
[cla][patch] now dojo.query("tagName#elemId") returns [] if elemId doesn't exist

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by Adam Peller

Owner: changed from anonymous to alex

comment:2 Changed 11 years ago by bill

Milestone: tbd1.3

as per today's meeting, punting these core bugs

Changed 10 years ago by nic

Attachment: query4.js.diff added

[cla][patch] now dojo.query("tagName#elemId") returns [] if elemId doesn't exist

comment:3 Changed 10 years ago by alex

Resolution: fixed
Status: newclosed

(In [16616]) adding existance test to ID filtering. Fixes #7368. !strict

comment:4 Changed 10 years ago by alex

thanks for the patch, this fix will go out for 1.3

comment:5 Changed 10 years ago by bill

Component: CoreQuery
Note: See TracTickets for help on using tickets.