Repository navigation
Fix tree views on WordPress 7.2 and require WordPress 6.9 - #52
Merged
Merged
Conversation
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-initanddata-wp-runnow skip a directive with a suffix and log a warning. The page'sdata-wp-watch--main, which renders the trees, anddata-wp-watch--urlno 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:
data-wp-on-asyncdirectives withdata-wp-on. No handler usescurrentTarget,preventDefault()orstopPropagation(), so none needswithSyncEvent().data-wp-ignore, deprecated in 6.9 and removed in 7.2.htmlApiDoctypeSystemIdserver state key, which left the server-rendered doctype system ID empty.Testing:
tests/html-api-integration-regression.phppasses against 6.9.0 and trunk.