Use .item() accessor for DOM attributes.

Avoid using array-access notation for DOM attribute lists.

Also fixed up some instances where we tried to use array-access notation
to look up an attribute by name.  Use node.getAttribute() for this instead.

Change-Id: Idb38d07b6e56901860faa9a2c0f8ceadea09654f