Skip to content

DOM: IntersectionObserver real viewport intersection semantics #341

Description

@mplsllc

Status

Current QuickJS capability auditing records IntersectionObserver targets as effectively always intersecting. That is a dangerous compatibility lie: lazy loaders and deferred widgets can run at the wrong time even though the API appears present.

Scope

  • Track observed targets and observer options (root, rootMargin, thresholds) in bounded storage.
  • Compute viewport/root intersection from current box geometry after layout/scroll.
  • Deliver entries only when threshold/intersection state changes.
  • Provide correct isIntersecting, intersectionRatio, target identity, and practical bounding/intersection rectangles.
  • observe, unobserve, disconnect, and realm/navigation teardown must be safe.

A staged V1 may support viewport root + threshold 0 first, but unsupported option shapes must be explicit rather than returning always-true results.

Acceptance

An offscreen target reports non-intersecting, scrolling it into view crosses the expected state/threshold once, scrolling out reverses it, and disconnect stops callbacks. Verify against a controlled lazy-load pattern on the G3.

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

    Labels

    area: js-engineDuktape, ES5 evaluator, JS bindingsenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions