Skip to content

Commit d50c032

Browse files
committed
Fix quirks mode functionality
1 parent 8071ad3 commit d50c032

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

html-api-debugger/html-api-integration.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function get_supports(): array {
1818
return array(
1919
'is_virtual' => $html_processor_rc->hasMethod( 'is_virtual' ),
2020
'full_parser' => method_exists( WP_HTML_Processor::class, 'create_full_parser' ),
21-
'quirks_mode' => $html_processor_state_rc->hasProperty( 'document_mode' ),
21+
'quirks_mode' => $html_processor_rc->hasProperty( 'compat_mode' ),
2222
'doctype' => method_exists( WP_HTML_Processor::class, 'get_doctype_info' ),
2323
'normalize' => method_exists( WP_HTML_Processor::class, 'normalize' ),
2424
);
@@ -63,10 +63,11 @@ function get_tree( string $html, array $options ): array {
6363
if (
6464
! $use_full_parser &&
6565
( $options['quirks_mode'] ?? false ) &&
66-
property_exists( WP_HTML_Processor_State::class, 'document_mode' ) &&
67-
defined( WP_HTML_Processor_State::class . '::QUIRKS_MODE' )
66+
property_exists( WP_HTML_Processor::class, 'compat_mode' ) &&
67+
defined( WP_HTML_Processor::class . '::QUIRKS_MODE' )
6868
) {
69-
$processor_state->getValue( $processor )->document_mode = WP_HTML_Processor_State::QUIRKS_MODE;
69+
$processor_compat_mode = new ReflectionProperty( WP_HTML_Processor::class, 'compat_mode' );
70+
$processor_compat_mode->setValue( $processor, WP_HTML_Processor::QUIRKS_MODE );
7071
$doctype_value = '';
7172
}
7273

html-api-debugger/interactivity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class="html-api-debugger-container html-api-debugger--grid"
153153
<label>Show closers <input type="checkbox" data-wp-bind--checked="state.showClosers" <?php wp_on_directive( 'input', 'handleShowClosersClick' ); ?>></label>
154154
<label>Show invisible <input type="checkbox" data-wp-bind--checked="state.showInvisible" <?php wp_on_directive( 'input', 'handleShowInvisibleClick' ); ?>></label>
155155
<span data-wp-bind--hidden="!state.htmlapiResponse.supports.is_virtual"><label>Show virtual <input type="checkbox" data-wp-bind--checked="state.showVirtual" <?php wp_on_directive( 'input', 'handleShowVirtualClick' ); ?>></label></span>
156-
<span data-wp-bind--hidden="!state.htmlapiResponse.supports.quirks_mode"><label>Quirks mode <input type="checkbox" data-wp-bind--checked="state.quirksMode" <?php wp_on_directive( 'input', 'handleQuirksModeClick' ); ?>></label></span>
156+
<span data-wp-bind--hidden="!state.htmlapiResponse.supports.quirks_mode"><label>Quirks mode <input type="checkbox" data-wp-bind--checked="state.quirksMode" data-wp-bind--disabled="state.fullParser" <?php wp_on_directive( 'input', 'handleQuirksModeClick' ); ?>></label></span>
157157
<span data-wp-bind--hidden="!state.htmlapiResponse.supports.full_parser"><label>Full parser <input type="checkbox" data-wp-bind--checked="state.fullParser" <?php wp_on_directive( 'input', 'handleFullParserClick' ); ?>></label></span>
158158
</div>
159159
<div>

html-api-debugger/readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Add a page to wp-admin for debugging the HTML API.
1313

1414
= 2.0 =
1515
* Add ability to replay token processing.
16+
* Fix quirks mode fragment parsing.
1617

1718
= 1.9 =
1819
* Update WordPress Playground links to use current query args.

0 commit comments

Comments
 (0)