[wp-trac] [WordPress Trac] #62584: Support more contexts in ::create_fragment method

WordPress Trac noreply at wordpress.org
Wed Nov 27 14:34:01 UTC 2024


#62584: Support more contexts in ::create_fragment method
--------------------------------------+-------------------------
 Reporter:  jonsurrell                |       Owner:  jonsurrell
     Type:  feature request           |      Status:  closed
 Priority:  normal                    |   Milestone:  6.8
Component:  HTML API                  |     Version:  6.5
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-------------------------
Changes (by Bernhard Reiter):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59467" 59467]:
 {{{
 #!CommitTicketReference repository="" revision="59467"
 HTML API: Allow more contexts in `create_fragment`.

 This changeset modifies `WP_HTML_Processor::create_fragment( $html,
 $context )` to use a full processor and `create_fragment_at_node` instead
 of the other way around. This makes more sense and makes the main factory
 methods more clear, where the state required for fragments is set up in
 `create_fragment_at_node` instead of in both `create_fragment` and
 `create_fragment_at_current_node`.

 This allows for more HTML contexts to be provided to the basic
 `create_fragment` where the provided context HTML is appended to
 `<!DOCTYPE html>`, a full processor is created, the last tag opener is
 found, and a fragment parser is created at that node via
 `create_fragment_at_current_node`.

 The HTML5lib tests are updated accordingly to use this new method to
 create fragments.

 Props jonsurrell, dmsnell, bernhard-reiter.
 Fixes #62584.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62584#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list