Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Faster Web Rendering with WICG Display Locking Proposal

Faster Web Rendering with WICG Display Locking Proposal

The Web Incubator Community Group (WICG) recently introduced Display Locking, a proposed set of web API changes that make it straightforward for developers and browsers to easily scale to large amounts of content and control when rendering work happens.

The proposal strives to accommodate many use cases, from quickly displaying very large HTML documents, to scrolling large amounts of content, to pre-rendering non-visible content asynchronously for later display, to the faster measurement of layouts. The proposal seeks to avoid loading and rendering for non-visible content without breaking web features and layout calculations, and to provide developers with flexibility for pre-rendering without rendering to the end user's screen.

Currently, the DOM renders atomically, taking more and more time to render as a site or application increases in size. Techniques employed today include hiding non-visible content or virtualization, but these approaches have limitations and reliability challenges.

The Display Locking proposal introduces three new features:

  • rendersubtree attribute, controlling whether a DOM subtrees renders. This attribute can get modified by a browser or other user agents, and fires a MutationObserver event for developers to respond.
  • content-size attribute, allocating a placeholder size for content marked as invisible by rendersubtree.
  • updateRendering method on Element objects to pre-render content within a subtree marked with rendersubtree as invisible.

In drafting this proposal, the WICG considered several alternatives, including the contain: strict, display:none, visibility: hidden CSS properties, but each lack sufficient control for both developers and user agents.

There are no current implementations of the proposal in today's web browsers. The proposal is in the early stages, and feedback is encouraged by joining the display locking community group. The Web Incubator Community Group (WICG) provides a lightweight venue for proposing and discussing new web platform features. Each proposal gets discussed in its repository within the group's Github account. Membership of the group is open to everybody, but all participants must first sign the W3C Community Contributor License Agreement.

Rate this Article