Handle duplicate attributes

This fixes a bug where the last attribute encountered overwrites all
others attributes having the same name.

It mimics browser behavior that only takes the first encountered argument.
Tested on Chrome a tag with double ids: ```<tag id=one id=two>``` it only takes the first id as reference.

Added test file.

Let me know what you think.