See the demo script at http://help.arcgis.com/en/webapi/jav...ind_popup.html and put a Firebug breakpoint on line 91:
feature.attributes should return the attributes of the feature, but instead it returns the aliases:
var feature = result.feature;
feature.attributes.layerName = result.layerName;
This is a crucial distinction since the attributes are guaranteed to be unique whereas the aliases may not be.
Ideally, feature.attributes should return the attributes while a new feature.aliases property could return the aliases.