jBoive
jBoive

Reputation: 1299

Why is it that I always get undefined from any JS object in XPiNC?

Lotus Notes 8.5.3FP3 UP1

I initialise some code on dojo.ready I hook up my table rows with an onclick handler:

dojo.query(document).delegate('tr', 'onclick', controller);

in my controller function I now expect to be able to do:

var obj = evt.target;

This works, I get an object in FireBug lite.

But if I try to do:

obj.tagName it returns undefined. In fact, it returns undefined regardless of what property I try to retrieve!

The same code works if I run it in the Firebug console. It all works perfectly in every browser, including IE7 and up!

Upvotes: 1

Views: 163

Answers (1)

jBoive
jBoive

Reputation: 1299

Ok, so I brought this one on myself...

XULRunner in Domino 8.5.3x is quite old and doesn't support obj.parentElement, so I used:

obj = obj.parentElement || dojo.query(obj).parent();

And then tried to do:

obj.tagName

See the problem?

Changing to:

obj = obj.parentElement || dojo.query(obj).parent()[0];

Solves it.

Upvotes: 1

Related Questions