Skip to content

img.complete behavior is wrong when a new load is started for the same image #4884

@bzbarsky

Description

@bzbarsky

Consider this testcase:

  var img = new Image();
  img.src = "url1";
  img.onload = () => {
    img.src = "url2"; // Make sure this is not in the document's loaded-images cache
    alert(img.complete);
  }

Per spec at https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete this should alert true because:

  • First bullet does not apply, because there is an src attribute
  • Second bullet does not apply, because src is nonempty
  • Third bullet, who knows
  • Fourth bullet applies (!) because there is a current request and its status is completely available.

Presumably complete should returns false if there is a pending request or something? It consistently returns false in browsers on the above testcase.

@EdgarChen @annevk @domenic

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions