Skip to content

[Bug]: webagg backend uses non-existent unload event #32393

Description

@QuLogic

Bug summary

The webagg backend uses the onunload attribute of the image to close the websocket:

this.imageObj.onunload = function () {
fig.ws.close();
};

I cannot find any such event for Images, for its parent HTMLElement interface, or for its parent Element class, or even the Node ABC.

The docs for the unload event say that it is only on the global Window interface, with onunload on the body, frameset, and svg elements. It is also not recommended for use.

Code for reproduction

In the browser console:

var img = new Image();
img.on<TAB>

Actual outcome

There is no onunload in the autocomplete in the browser console.

Expected outcome

We should remove the onunload entirely, but I am uncertain as to whether we should be closing the websocket explicitly somewhere else.

Matplotlib Version

main

Matplotlib Backend

WebAgg

Installation

git checkout

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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