Rework r269444 to work also for lists without IDs.

MFC after:	3 days