It took me a long time to figure out how to check if a node in a dijit.tree is already set to selected, when the user clicks on it. So I thought I share what I found out:
dojo.connect(this.tree, 'onMouseDown', this, function(evt) { var node = dijit.getEnclosingWidget(evt.target); if (node.item == this.tree.attr('selectedItem')) { console.debug('selected'); } });