diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-10-10 16:14:40 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-10-11 13:56:07 +0200 |
commit | 605c679fee29302321878a74b88aa7165519b516 (patch) | |
tree | c52ffde5e21c61b3a5cbdc5aa308247741bb708d /components/script/dom/htmlimageelement.rs | |
parent | 826352ab4cae13f5154d13ab53885d80a8057337 (diff) | |
download | servo-605c679fee29302321878a74b88aa7165519b516.tar.gz servo-605c679fee29302321878a74b88aa7165519b516.zip |
Fix URL attributes
URL attributes should always use AttrValue::Url, and the input should be
resolved against the document's base URL at setting time always.
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 027221a88f0..a9b2f01e283 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -824,8 +824,9 @@ impl HTMLImageElementMethods for HTMLImageElement { // https://html.spec.whatwg.org/multipage/#dom-img-src make_url_getter!(Src, "src"); + // https://html.spec.whatwg.org/multipage/#dom-img-src - make_setter!(SetSrc, "src"); + make_url_setter!(SetSrc, "src"); // https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin fn GetCrossOrigin(&self) -> Option<DOMString> { @@ -980,6 +981,7 @@ impl VirtualMethods for HTMLImageElement { fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue { match name { + &local_name!("src") => AttrValue::from_url(document_from_node(self).base_url(), value.into()), &local_name!("name") => AttrValue::from_atomic(value.into()), &local_name!("width") | &local_name!("height") => AttrValue::from_dimension(value.into()), &local_name!("hspace") | &local_name!("vspace") => AttrValue::from_u32(value.into(), 0), |