Skip to content

Fix tree views on WordPress 7.2 and require WordPress 6.9 - #52

Merged
sirreal merged 4 commits into
mainfrom
fix-wp72-watch-directives
Oct 27, 2026
Merged

sirreal merged 4 commits into
mainfrom
fix-wp72-watch-directives

Conversation

@sirreal

@sirreal sirreal commented Oct 26, 2026

Copy link
Copy Markdown
Owner

On WordPress 7.2, the HTML API tree, the DOM tree and the rendered iframe stop updating after the first render. Edits still send requests, and the processed HTML still updates.

gutenberg#84098 removed two-hyphen unique IDs: data-wp-watch, data-wp-init and data-wp-run now skip a directive with a suffix and log a warning. The page's data-wp-watch--main, which renders the trees, and data-wp-watch--url no longer run. They now use the three-hyphen form, data-wp-watch---main.

WordPress 6.9 added three-hyphen unique IDs on the client (gutenberg#72161) and the server (r61020), so the plugin now requires 6.9. It is tested up to 7.2. With 6.9 as the minimum, the create_fragment_at_current_node() checks and the fallback to the doctype property name before r60647 (indicated_compatability_mode) are removed.

Also:

  • Replace the deprecated data-wp-on-async directives with data-wp-on. No handler uses currentTarget, preventDefault() or stopPropagation(), so none needs withSyncEvent().
  • Remove data-wp-ignore, deprecated in 6.9 and removed in 7.2.
  • Fix the misspelled htmlApiDoctypeSystemId server state key, which left the server-rendered doctype system ID empty.
  • Replace the 6.7 Playground version option with 6.9.

Testing:

  • In a browser with the Interactivity runtimes from 6.9, 7.1 and 7.2-beta1: input edits, the closers toggle, hover highlighting, context HTML, URL updates and the playback slider update both trees, with no console warnings. Before the change, 7.2-beta1 fails every update check.
  • tests/html-api-integration-regression.php passes against 6.9.0 and trunk.

WordPress 7.2 (Gutenberg #84098) ignores `data-wp-watch`, `data-wp-init` and `data-wp-run` directives with a two-hyphen suffix. The `--main` and `--url` watches stopped running, so after the first render the HTML API tree, DOM tree and rendered iframe no longer updated on edits. Use the three-hyphen unique ID form instead. WordPress 6.9 added that form on the client (Gutenberg #72161) and the server (r61020), so require 6.9.

Remove `data-wp-ignore`. WordPress 6.9 deprecated it and 7.2 removed it; the elements were already hydrated on 7.2.

Fix the misspelled `htmlApiDoctypeSystemId` server state key, which left the server-rendered doctype systemId empty.

Replace the 6.7 Playground version option with 6.9, the new minimum.

Tested in a browser with the 6.9, 7.1 and 7.2-beta1 Interactivity runtimes: edits, the show-closers toggle, hover highlighting, the context button, URL updates and playback all update both trees, with no console warnings.
WordPress 6.9 is now the minimum version. `WP_HTML_Processor::create_fragment_at_current_node()` exists since 6.8, so the `method_exists()` guards always passed. Remove them, along with the `create_fragment_advanced` support flag that hid the context HTML field and made the client ignore context HTML.

WordPress 6.9 renamed `WP_HTML_Doctype_Info::$indicated_compatability_mode` to `$indicated_compatibility_mode` (r60647). Read the new name directly.

The method is still private, so it is still called through reflection.

Tested: tests/html-api-integration-regression.php passes against 6.9.0 and trunk; compat mode is CSS1Compat for `<!DOCTYPE html>` and BackCompat for a quirks or missing doctype, with and without context HTML; in the browser the context field shows and a `<table><tr>` context gives matching HTML API and DOM trees.
@sirreal
sirreal merged commit 8a4ec8a into main Oct 27, 2026
@sirreal
sirreal deleted the fix-wp72-watch-directives branch October 27, 2026 05:38
@sirreal sirreal mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant