w3c / w3c/csswg-drafts

[resize-observer] In shipping browsers, observe() doesn't call unobserve()

Open
#12,902 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

resize-observer-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Per the current spec, observe(target, options) is suppose to call unobserve(target) if target is already in the observationTargets.

From my understanding, this should clear the lastReportedSizes array for the target. Hence, even if the target hasn't changed size, re-calling observe with the target should always fire an observation.

In practice, all major web browsers do not appear to implement this. Instead, to get the observation to fire, I must manually call unobserve(target) first and then call observe(target) again.

In this example, adding or removing a column should always trigger an observation. However, it only triggers an observation if I explicitly call unobserve() first.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ResizeObserver observe() and unobserve() algorithms in the current specification, then reproduce the behavior using the linked JSFiddle example. Compare the specification's expected handling of observationTargets and lastReportedSizes with shipping-browser behavior; done means the discrepancy and required specification change are resolved or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.