Should check if attribute exists in order to throw Error

When a DOM element does not have an id it returns an empty string instead of undefined.

Related to https://github.com/eduardolundgren/senna/commit/534004fc37ed5981fe3ffd89fdd9b3aac91cd603#commitcomment-7767287