Skip to content

[css-display-3] display: unload to observably unload element state #12462

@dead-claudia

Description

@dead-claudia

The idea is this: it renders like display: none, but further unloads state to save on memory. I'm filing this here, but it also would require significant changes to the HTML spec.

  • Images and iframes are unloaded. Transitioning back to any other display value causes fetches to happen anew like it was just added, firing an additional load event once (re)loaded.
  • Animations are cut off by display: unload and reset upon display changing back to something other than unload.
  • Inputs' state resets upon display changing to unload.
  • Audio and video play state resets upon display changing to unload.
  • Focus removal occurs upon display changing to unload in the same way they fire on element removal.
  • Custom elements can observe changes via .attachedCallback() and .detachedCallback(). .connectedCallback() and .disconnectedCallback() would default to these if missing.
  • Probably other stuff I may be missing.

The idea is to unload external state for things like inactive popovers, inactive tabs, and inactive routes (see WICG/declarative-partial-updates#14). It does not cause elements to be actually removed unless observing JS callbacks do so explicitly, but it has most of the observable side effects that element removal has.

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