Skip to main content
KadiCache
Pro Local CWVPro Local

Self-Healing Delay JS

Compares pre-Delay and post-Delay DOM geometry directly inside real visitor browsers (Desktop & Mobile) with zero Cloud worker quota, then injects pure-CSS geometric locks that hold sliders, entrance animations, loading spinners, and collapsed ad slots steady until delayed scripts hydrate.

Real-Browser Delay Lock
0 ms Fix
Verified Source Entry
apps/wordpress-plugin-pro/src/Local/BrowserHintsRewriter.php
Verified Engine Capabilities

Engineered for zero regressions.

  • 4 universal pure-geometry lock kinds (carousel, reveal, hide, height) working across Elementor, WPBakery, Divi, Slick, Swiper, Owl, Splide & custom themes without plugin hardcoding
  • Learns separately for Desktop (>=768px) and Mobile (<=767px) in real visitor browsers over HMAC-signed same-origin POST /wp-json/kadicache-pro/v1/browser-hints
  • Zero-churn in-place disk cache patching updates cached HTML with 0 cache purges and auto-releases locks via delay.js tier-2 handoff when scripts initialize
  • Toggleable in WP Admin -> CSS & JavaScript, KadiCache Pulse (pro_delay_locks_enabled), and AI MCP manage_pro_cloud with 0 Cloud compute quota
Enabling Self-Healing Delay JS via AI MCP (manage_pro_cloud)
# Enable Self-Healing Delay JS remotely on a connected Cloud Pro site
manage_pro_cloud {
  "action": "configure",
  "toggles": { "delay_locks": true }
}

# Inspect live status (features.delay_locks_enabled & local_hints_learned)
manage_pro_cloud { "action": "status" }
Inside the KadiCache WordPress Plugin

Self-Healing Delay JS — Plugin Interface

3 live 2x Retina plugin screens
WP Admin -> KadiCache -> CSS & JavaScript -> Self-Healing Delay JS
MODULE 19 · 2X RETINA
Self-Healing Delay JS tracks real-browser learned Desktop & Mobile viewports, shared templates, Watchdog CLS health, and 1-click template learning.2880×1840 WebP
100% Source-Code Verified8 min engineering readUpdated 2026-11-30
Executive Summary · 30-Second SpecZero-Regressions Spec
WP Admin Path
WP Admin -> KadiCache -> CSS & JavaScript (Self-Healing Delay JS)
Measured Impact
0ms Pure-CSS Pre-Interaction Visual Fidelity · 0 Cloud Quota
Verification Marker
kadicache-local-delay-css | kadicache_pro_local_delay_locks
  • Eliminates the classic Delay JS visual breakage problem (stacked carousel slides, opacity: 0 entrance animations, frozen preloaders, and collapsed 0px ad slots) automatically with zero manual CSS rules.
  • Measures real pre- vs post-Delay DOM geometry directly inside real visitor browsers (Desktop >=768px and Mobile <=767px) via HMAC-signed POST /wp-json/kadicache-pro/v1/browser-hints.
  • Generates pure-geometry CSS locks (carousel, reveal, hide, height) in <style id="kadicache-local-delay-css" data-kadicache-layout-tier="2"> and patches cached HTML in place with 0 cache purges.
  • Removes lock CSS cleanly via delay.js tier-2 handoff the moment delayed scripts initialize, and is toggleable from WP Admin, KadiCache Pulse (pro_delay_locks_enabled), and AI MCP (delay_locks).
Table of Contents (4 sections)

Why Standard Delay JavaScript Breaks Carousels, Animations & Preloaders#

Enabling Delay JavaScript Until Interaction is the fastest way to slash mobile Total Blocking Time (TBT) toward 0 ms. Yet on real WordPress and WooCommerce sites built with Elementor, WPBakery, Divi, Avada, or custom themes, holding JavaScript until first scroll or tap exposes four recurring visual defects at initial 0 ms paint:

  1. Stacked Vertical Carousels: Before Slick, Swiper, Owl Carousel, Splide, or Flickity scripts run, a 4-column horizontal product row stacks all 6 or 12 slides vertically in raw HTML, inflating initial page height and causing a massive layout jump when the visitor touches the screen.
  2. Invisible Entrance Animations (opacity: 0): Headlines, hero cards, and GSAP/AOS/Salient reveal blocks wait for an intersection or scroll script to flip opacity: 1 and transform: none, leaving blank white gaps above the fold.
  3. Stuck Loading Spinners & Page Preloaders: Overlays and .loading-spin indicators remain visible until a delayed script hides them.
  4. Collapsed 0px Widget & Ad Slots: Flex containers whose height is calculated by JavaScript start at 0px, then shove surrounding content downward once scripts wake up.

Self-Healing Delay JS (kadicache_pro_local_delay_locks) solves all four defects generically from pure DOM geometry—without maintaining fragile theme or plugin class blocklists, and without consuming Cloud Pro worker quota.

FIG 01Self-Healing Delay JS tracks real-browser learned Desktop & Mobile viewports, shared templates, Watchdog CLS health, and 1-click template learning.Zoom 2x

How the 4 Universal Pure-Geometry Lock Kinds Work#

On the first real visitor visit for an unlearned URL (separately for Desktop and Mobile), local-vitals-beacon.js snapshots candidate container geometry before delayed scripts execute and again after delayed scripts finish hydrating, then posts a compact HMAC-SHA256 signed payload to POST /wp-json/kadicache-pro/v1/browser-hints (rejecting bots, HeadlessChrome, Lighthouse, and cross-origin requests):

Lock KindPre-Delay Visual Defect ObservedPure-CSS Lock Applied at 0 ms (kadicache-local-delay-css)Automatic Release
carouselUninitialized multi-slide or single-slide slider stacking cards vertically or hiding slidesLocks container into exact N-column CSS Grid (repeat(N, minmax(0, 1fr))), suppresses ::before/::after clearfix column theft, and hides overflow slides (:nth-child(n+N+1))Removed on delay.js tier-2 handoff
revealHero heading, card, or GSAP/AOS block stuck at opacity: 0, visibility: hidden, or off-position transformForces opacity: 1 !important; visibility: visible !important (and transform: none !important when translated/scaled) at 0 msRemoved cleanly once script applies final class
hidePreloader overlay or in-container spinner visible pre-JS that disappears post-JSApplies display: none !important at 0 ms while strictly skipping off-screen mobile drawers and navigation menusRemoved automatically on hydration
heightCollapsed 0px banner/widget slot that expands after delayed JS runsReserves exact measured post-JS min-height to prevent vertical CLS jumpReleased once script populates height

Zero-Churn In-Place Patching & Shared-HTML Responsive Support#

FIG 02Inspect active pure-CSS geometric locks per scope (Global, Template, and Page) with Watchdog Verified badges and 1-click Re-learn or Reset.Zoom 2x
  • Zero Cache Purges (BrowserHintsEndpoint::applyHintsInPlace()): When the first real Desktop or Mobile visitor submits learned locks, KadiCache patches the existing cached HTML file on disk atomically via kadicache_patch_cached_html without triggering a cache rebuild storm.
  • Shared HTML (@media) Ready: Sites running Cloudflare Free Edge Cache with Separate Mobile Cache disabled still learn Desktop (>=768px) and Mobile (<=767px) column counts independently—emitting a single responsive <style id="kadicache-local-delay-css"> block with separate breakpoints (e.g., 4 columns on desktop, 2 columns on mobile).
  • Survives Cache Clears: Learned geometric rows live in wp_kadicache_pro_browser_hints (delay_json) and persist across full cache purges, resetting automatically only when you switch themes, update a post, or click Reset learned data.
  • Zero Stuck Locks & Guarded Edge Cases: Automated Chromium regression tests (tests/unit/pro-local-vitals.mjs) and a 1,618-site / 3,236-run Desktop + Mobile real-browser benchmark verified 0 stuck locks and 0 JS console errors, with strict guards protecting off-screen mobile drawers, hover mega-menus, ::before clearfix rows, and display: none modal ancestors.

Honest Boundaries: What Still Belongs to Delay Exclusions & Improve LCP#

Self-Healing Delay JS is engineered for geometric and visibility stabilization of elements already present in server HTML. Two cases intentionally remain handled by dedicated KadiCache tools:

  • Hero images using JS-only data-src lazy-loading: Pair Self-Healing Delay JS with Pro Local Improve LCP, which de-lazies real above-the-fold hero images and injects responsive fetchpriority="high" preloads directly in HTML.
  • Interactive JS-rendered calculators or remote widgets: If a widget has zero HTML before its script fetches remote data and must be interactive at 0 ms, add its script handle to Delay JavaScript Exclusions (delay_js_exclusions) or tag it with data-kadicache-no-delay.

Follow the step-by-step setup and verification walkthrough in the Self-Healing Delay JS Documentation Guide.

Gergis — Lead Systems & Cache Architect
Principal WordPress & Cloud Edge Architect
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

apps/wordpress-plugin-pro/src/Local/LocalSettings.phpapps/wordpress-plugin-pro/src/Local/BrowserHintsRewriter.phpapps/wordpress-plugin-pro/src/Local/BrowserHintsEndpoint.phpapps/wordpress-plugin-pro/assets/local-vitals-beacon.jsapps/wordpress-plugin-pro/src/Cloud/McpExtension.php

Technical FAQ

Is Self-Healing Delay JS included in Free Core or KadiCache Pro?

Self-Healing Delay JS is a KadiCache Pro feature (gated by an active KadiCache Cloud Pro license or 7-Day Free Trial). Free Core displays the locked Cloud Pro control in WP Admin and KadiCache Pulse so you can upgrade seamlessly without changing settings structure.

How is Self-Healing Delay JS different from Cloud Layout Stability?

Cloud Layout Stability renders pages on KadiCache Cloud workers alongside Cloud WebP/RUCSS, whereas Self-Healing Delay JS runs 100% locally in real visitor browsers with zero Cloud queue wait—learning exact carousel column counts, entrance animation reveals, preloader hides, and collapsed slot heights automatically per device.

Can I enable or disable Self-Healing Delay JS from KadiCache Pulse?

Yes. Open KadiCache Pulse -> CSS & JavaScript -> JavaScript Execution & Minification and toggle Self-Healing Delay JS (pro_delay_locks_enabled). On active Pro sites it updates WordPress live over OAuth 2.1 MCP; on Free sites it displays the Pro lock state identically to all other Pro features.

What happens if Delay JavaScript is turned off while Self-Healing Delay JS is enabled?

Self-Healing Delay JS automatically enters a zero-overhead Waiting for Delay state without injecting any beacon or CSS, and resumes immediately whenever Delay Until Interaction is turned back on.