This project is archived and is in readonly mode.

#423 ✓invalid

$defined throws error for undeclared variables.

Reported by Michal | October 13th, 2008 @ 06:42 PM | in 2.0 (closed)

I'm not sure this is a bug, but just in case...

$defined throws an error for variables that have not been declared. I thought that "undefined" would mean the same thing as "not declared", so I expected this function to return false for undeclared variables.

If it's not a bug, then maybe it should be mentioned in the docs about the behaviour for undeclared variables?

Also: there is an inconsistency for global variables. For an undeclared global variable $defined(notDeclared) throws an error, but $defined(window.notDeclared) returns false.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins