From 6e48d0f65a424c60348ba8bae0c4f7e554f5dae7 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 31 Oct 2017 22:04:13 +0000 Subject: [PATCH] media_element: Also check for unknown attributes. --- src/media_element.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/media_element.rs b/src/media_element.rs index 478dbb31..b700eec1 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -57,9 +57,8 @@ impl TryFrom for MediaElement { type Err = Error; fn try_from(elem: Element) -> Result { - if !elem.is("media", ns::MEDIA_ELEMENT) { - return Err(Error::ParseError("This is not a media element.")); - } + check_self!(elem, "media", ns::MEDIA_ELEMENT); + check_no_unknown_attributes!(elem, "media", ["width", "height"]); let mut media = MediaElement { width: get_attr!(elem, "width", optional),