Make WordPress Core


Ignore:
Timestamp:
03/13/2024 09:28:48 AM (3 months ago)
Author:
swissspidy
Message:

HTML API: Trigger active format reconstruction when reaching text nodes.

When encountering text nodes in an HTML document, the HTML parser needs
to run the active format reconstruction algorithm, even if it doesn't
stop to visit those text nodes. This is because the formats, which might
need reconstructing, will impact the breadcrumbs of all downstream nodes
from the text node.
In this patch, this process is triggered, which properly triggers the
active format reconstruction. It also enables the visiting of other token
types as is possible in the Tag Processor.

Developed in https://github.com/WordPress/wordpress-develop/pull/6054
Discussed in https://core.trac.wordpress.org/ticket/60170

Reviewed by swissspidy.
Merges [57806] to the to the 6.5 branch.

Props: dmsnell, jonsurrell, westonruter.
Fixes: #60455.
Follow-up to: [57348].

Location:
branches/6.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.5

  • branches/6.5/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php

    r57508 r57823  
    129129        $this->assertFalse( $processor->is_tag_closer(), 'Did not find that initial DIV tag is an opener.' );
    130130
     131        $processor->step();
     132        $this->assertSame( '#text', $processor->get_token_type(), 'Should have found the text node.' );
     133
    131134        /*
    132135         * When encountering the BUTTON closing tag, there is no BUTTON in the stack of open elements.
Note: See TracChangeset for help on using the changeset viewer.