Skip to content

HTML API: Fix typo in indicated_compatibility_mode #9401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/wp-includes/html-api/class-wp-html-doctype-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class WP_HTML_Doctype_Info {
* This value should be considered "read only" and not modified.
*
* When an HTML parser has not already set the document compatibility mode,
* (e.g. "quirks" or "no-quirks" mode), it will infer if from the properties
* (e.g. "quirks" or "no-quirks" mode), it will be inferred from the properties
* of the appropriate DOCTYPE declaration, if one exists. The DOCTYPE can
* indicate one of three possible document compatibility modes:
*
Expand All @@ -150,7 +150,7 @@ class WP_HTML_Doctype_Info {
*
* @var string One of "no-quirks", "limited-quirks", or "quirks".
*/
public $indicated_compatability_mode;
public $indicated_compatibility_mode;

/**
* Constructor.
Expand Down Expand Up @@ -194,7 +194,7 @@ private function __construct(
* > The force-quirks flag is set to on.
*/
if ( $force_quirks_flag ) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

Expand All @@ -203,7 +203,7 @@ private function __construct(
* public or system identifiers; short-circuit to avoid extra parsing.
*/
if ( 'html' === $name && null === $public_identifier && null === $system_identifier ) {
$this->indicated_compatability_mode = 'no-quirks';
$this->indicated_compatibility_mode = 'no-quirks';
return;
}

Expand All @@ -214,7 +214,7 @@ private function __construct(
* the document in upper case; thus no conversion is required here.
*/
if ( 'html' !== $name ) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

Expand Down Expand Up @@ -242,15 +242,15 @@ private function __construct(
'-/w3c/dtd html 4.0 transitional/en' === $public_identifier ||
'html' === $public_identifier
) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

/*
* > The system identifier is set to…
*/
if ( 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd' === $system_identifier ) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

Expand All @@ -259,7 +259,7 @@ private function __construct(
* If the public identifier is empty, none of the following conditions will match.
*/
if ( '' === $public_identifier ) {
$this->indicated_compatability_mode = 'no-quirks';
$this->indicated_compatibility_mode = 'no-quirks';
return;
}

Expand Down Expand Up @@ -327,7 +327,7 @@ private function __construct(
str_starts_with( $public_identifier, '-//webtechs//dtd mozilla html 2.0//' ) ||
str_starts_with( $public_identifier, '-//webtechs//dtd mozilla html//' )
) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

Expand All @@ -340,7 +340,7 @@ private function __construct(
str_starts_with( $public_identifier, '-//w3c//dtd html 4.01 transitional//' )
)
) {
$this->indicated_compatability_mode = 'quirks';
$this->indicated_compatibility_mode = 'quirks';
return;
}

Expand All @@ -356,7 +356,7 @@ private function __construct(
str_starts_with( $public_identifier, '-//w3c//dtd xhtml 1.0 frameset//' ) ||
str_starts_with( $public_identifier, '-//w3c//dtd xhtml 1.0 transitional//' )
) {
$this->indicated_compatability_mode = 'limited-quirks';
$this->indicated_compatibility_mode = 'limited-quirks';
return;
}

Expand All @@ -369,11 +369,11 @@ private function __construct(
str_starts_with( $public_identifier, '-//w3c//dtd html 4.01 transitional//' )
)
) {
$this->indicated_compatability_mode = 'limited-quirks';
$this->indicated_compatibility_mode = 'limited-quirks';
return;
}

$this->indicated_compatability_mode = 'no-quirks';
$this->indicated_compatibility_mode = 'no-quirks';
}

/**
Expand All @@ -387,15 +387,15 @@ private function __construct(
*
* // Normative HTML DOCTYPE declaration.
* $doctype = WP_HTML_Doctype_Info::from_doctype_token( '<!DOCTYPE html>' );
* 'no-quirks' === $doctype->indicated_compatability_mode;
* 'no-quirks' === $doctype->indicated_compatibility_mode;
*
* // A nonsensical DOCTYPE is still valid, and will indicate "quirks" mode.
* $doctype = WP_HTML_Doctype_Info::from_doctype_token( '<!doctypeJSON SILLY "nonsense\'>' );
* 'quirks' === $doctype->indicated_compatability_mode;
* 'quirks' === $doctype->indicated_compatibility_mode;
*
* // Textual quirks present in raw HTML are handled appropriately.
* $doctype = WP_HTML_Doctype_Info::from_doctype_token( "<!DOCTYPE\nhtml\n>" );
* 'no-quirks' === $doctype->indicated_compatability_mode;
* 'no-quirks' === $doctype->indicated_compatibility_mode;
*
* // Anything other than a proper DOCTYPE declaration token fails to parse.
* null === WP_HTML_Doctype_Info::from_doctype_token( ' <!DOCTYPE>' );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ private function step_initial(): bool {
*/
case 'html':
$doctype = $this->get_doctype_info();
if ( null !== $doctype && 'quirks' === $doctype->indicated_compatability_mode ) {
if ( null !== $doctype && 'quirks' === $doctype->indicated_compatibility_mode ) {
$this->compat_mode = WP_HTML_Tag_Processor::QUIRKS_MODE;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/html-api/wpHtmlDoctypeInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function test_doctype_doc_info(

$this->assertSame(
$expected_compat_mode,
$doctype->indicated_compatability_mode,
'Failed to infer the expected document compatability mode.'
$doctype->indicated_compatibility_mode,
'Failed to infer the expected document compatibility mode.'
);

$this->assertSame(
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2980,7 +2980,7 @@ public function test_doctype_doc_name() {
$doctype = $processor->get_doctype_info();
$this->assertNotNull( $doctype );
$this->assertSame( 'html', $doctype->name );
$this->assertSame( 'no-quirks', $doctype->indicated_compatability_mode );
$this->assertSame( 'no-quirks', $doctype->indicated_compatibility_mode );
$this->assertNull( $doctype->public_identifier );
$this->assertNull( $doctype->system_identifier );
}
Expand Down
Loading