#737 - Treat attribute parsing errors as per the spec
This MR removes the concept of elements being in error due to attributes having invalid values. Instead, it changes the code to do what the spec recommends: in case of an invalid value, ignore it and revert back to the attribute's initial value.
How this works:
-
An
ElementInner
gets created, with aDefault::default()
of its actual element implementation. That is supposed to contain the initial values for all attributes. -
The element's attributes get parsed.
set_attributes()
implementations call a new helper function,set_attribute(&mut self.some_attr, attr.parse(value), session)
. What that does is to look at the Result from theparse()
; if successful it will overwrite the&mut
, and if error it will just log the error in thesession
. No errors are returned upstream. -
set_attributes()
is now infallible, which ends up making a lot of upstream code simpler.
Fixes #737 (closed).