tightened up the attribute parsing rules

note that this does not fix the fact the the error thrown when the attribute fails parsing is the wrong error. This gets addressed in https://bugzilla.mozilla.org/show_bug.cgi?id=943432