Opened 12 years ago

Closed 12 years ago

#4396 closed defect (fixed)

dojox.validate.check.js references dj_undef() function, but dj_undef() is not defined

Reported by: guest Owned by: dante
Priority: high Milestone:
Component: Dojox Version: 0.9
Keywords: dojox.validate.check dj_undef Cc: lloydmurray@…
Blocked By: Blocking:

Description

dojox.validate.check.js uses the method/function dj_undef in several places (lines: 48, 56, 64, 72, 80, 91, 97, 135, 155, 175, 212). This method was used in 0.4.3, but seems to be phased out in 0.9. Currently the code fails trying to reference dj_undef. It either needs to be defined in check.js, or the above lines need to be changed not to use this function.

Here is the function dj_undef from 0.4.3

function dj_undef(name, object) {

return (typeof (object
dj_currentContext)[name] == "undefined");

}

I've added this to check.js in my local copy, and it seems to work.

Attachments (1)

validate.patch (942 bytes) - added by dante 12 years ago.
possible fix.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by dante

Owner: changed from Tom Trenka to dante
Status: newassigned

comment:2 Changed 12 years ago by dante

not a problem to fix, though i want to ask first: what made dj_undef more robust than just checking typeof elm == "underfined" ? is the dj_currentContext important to the workings of dojox.validate.check (i'm unsure)? i can't/won't define dj_undef globally from a dojox module, so would do it locally, or just use a simple typeof check? is dj_currentContext still available? any ideas? i don't use dojox.validate, i just ported it ...

Changed 12 years ago by dante

Attachment: validate.patch added

possible fix.

comment:3 Changed 12 years ago by dante

also, because of either no DOH test exists or #4350 is open - there is no way to test this. please attach a simple test case, or apply the attached patch to see if the problem persits. (it also would fix #4397, i think)

comment:4 Changed 12 years ago by James Burke

I suggest not using the dj_ names in the code. This was used in the 0.4 code for some "global" functions, but we've moved away from that in 0.9.

  • dj_currentContext is now dojo.global
  • dj_undef(name) can be accomplished via dojo.getObject(name)

getObject will use dojo.global internally. If you want to force a specific "global" (window object in the browser), you can use dojo.withGlobal() or dojo.getObject(name, false, yourGlobalHere).

comment:5 Changed 12 years ago by dante

Resolution: fixed
Status: assignedclosed

(In [10462]) dojox checkin fixes #4396 and $4397 - wrt to: #4396, its a quick and dirty solution using a local function to return undefined true / false. please reopen if is not robust enough or doesn't work for your scope, and will then implement jburke's suggestion of using dojo.getObject. need to fix unit tests badly, and obviously add a dojox.validate.check DOH test. any contributions welcome. ;)

Note: See TracTickets for help on using tickets.