Skip to content

Add reusable DOM lifecycle observers for browser artifacts #661

@chubes4

Description

@chubes4

Problem

Browser performance/debug rigs repeatedly need the same DOM lifecycle timings, but each workload currently writes custom observer code. That makes metrics inconsistent and easy to break when observers run before the document root exists or when elements are replaced during hydration.

Proposal

Add reusable DOM lifecycle observer helpers that can be installed before page scripts and reported in browser artifacts.

Suggested metrics per observed selector/id:

  • first_seen_ms
  • first_visible_ms
  • first_child_ms
  • first_iframe_ms
  • first_visible_iframe_ms
  • first_button_ms
  • first_visible_button_ms
  • stable_visible_ms
  • removed_count
  • peak_child_count
  • peak_iframe_count
  • peak_visible_iframe_count
  • peak_button_count
  • peak_visible_button_count
  • final_child_count
  • final_iframe_count
  • final_visible_iframe_count
  • final_button_count
  • final_visible_button_count

Requirements

  • Safe to install before document.documentElement exists.
  • Records metrics relative to the same clock used by browser probe artifacts.
  • Handles elements appearing, disappearing, and being replaced.
  • Can observe one or more selectors in the same run.
  • Does not contain product-specific assumptions about WooCommerce, Stripe, wallets, or payment buttons.

Acceptance criteria

  • Browser artifacts include lifecycle metrics for configured selectors.
  • A smoke test covers an element that appears after page load.
  • A smoke test covers observer installation before document.documentElement is available.
  • Existing probes without observers remain unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions