Attributes delegate namespace lookup to the parent element

Also add inital tests for the attribute object, and make attributes
track which element they are assigned to.