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

WordPress Trac noreply at wordpress.org
Thu Nov 28 14:26:08 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:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59469" 59469]:
 {{{
 #!CommitTicketReference repository="" revision="59469"
 HTML API: Make non-body fragment creation methods private.

 The current implementation of `create_fragment` (and the underlying
 `create_fragment_at_current_node`) allows passing in a context that might
 result in a tree that cannot be represented by HTML. For example, a user
 might use `<p>` as context, and attempt to create a fragment that also
 consists of a paragraph element, `<p>like this`. This would result in a
 paragraph node nested inside another -- something that can never result
 from parsing HTML.

 To prevent this, this changeset makes `create_fragment_at_current_node`
 private and limits `create_fragment` to only `<body>` as context, while a
 comprehensive solution to allow other contexts is being worked on.

 Follow-up to [59444], [59467].
 Props jonsurrell, dmsnell, bernhard-reiter.
 Fixes #62584.
 }}}

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


More information about the wp-trac mailing list