aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/htmlimageelement.rs15
-rw-r--r--components/script/dom/webidls/HTMLImageElement.webidl4
2 files changed, 12 insertions, 7 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 8107d8bcb5d..4ef2fccc79d 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -1414,6 +1414,11 @@ impl HTMLImageElementMethods for HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#dom-img-src
make_setter!(SetSrc, "src");
+ // https://html.spec.whatwg.org/multipage/#dom-img-srcset
+ make_getter!(Srcset, "srcset");
+ // https://html.spec.whatwg.org/multipage/#dom-img-src
+ make_setter!(SetSrcset, "srcset");
+
// https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin
fn GetCrossOrigin(&self) -> Option<DOMString> {
reflect_cross_origin_attribute(self.upcast::<Element>())
@@ -1487,13 +1492,13 @@ impl HTMLImageElementMethods for HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#dom-img-complete
fn Complete(&self) -> bool {
let elem = self.upcast::<Element>();
- // TODO: take srcset into account
- if !elem.has_attribute(&local_name!("src")) {
- return true;
+ let srcset_absent = !elem.has_attribute(&local_name!("srcset"));
+ if !elem.has_attribute(&local_name!("src")) && srcset_absent {
+ return true
}
let src = elem.get_string_attribute(&local_name!("src"));
- if src.is_empty() {
- return true;
+ if srcset_absent && src.is_empty() {
+ return true
}
let request = self.current_request.borrow();
let request_state = request.state;
diff --git a/components/script/dom/webidls/HTMLImageElement.webidl b/components/script/dom/webidls/HTMLImageElement.webidl
index 4f5be4daf7c..b7dddd07b9f 100644
--- a/components/script/dom/webidls/HTMLImageElement.webidl
+++ b/components/script/dom/webidls/HTMLImageElement.webidl
@@ -9,8 +9,8 @@ interface HTMLImageElement : HTMLElement {
attribute DOMString alt;
[CEReactions]
attribute DOMString src;
- // [CEReactions]
- // attribute DOMString srcset;
+ [CEReactions]
+ attribute DOMString srcset;
[CEReactions]
attribute DOMString? crossOrigin;
[CEReactions]