media_element: Also check for unknown attributes.

This commit is contained in:
Emmanuel Gil Peyrot 2017-10-31 22:04:13 +00:00
parent 4875f15201
commit 6e48d0f65a

View file

@ -57,9 +57,8 @@ impl TryFrom<Element> for MediaElement {
type Err = Error; type Err = Error;
fn try_from(elem: Element) -> Result<MediaElement, Error> { fn try_from(elem: Element) -> Result<MediaElement, Error> {
if !elem.is("media", ns::MEDIA_ELEMENT) { check_self!(elem, "media", ns::MEDIA_ELEMENT);
return Err(Error::ParseError("This is not a media element.")); check_no_unknown_attributes!(elem, "media", ["width", "height"]);
}
let mut media = MediaElement { let mut media = MediaElement {
width: get_attr!(elem, "width", optional), width: get_attr!(elem, "width", optional),