[wp-trac] [WordPress Trac] #64513: HTML_Processor gets wrong breadcrumbs for elements in <head>

WordPress Trac noreply at wordpress.org
Thu Jan 15 23:45:22 UTC 2026


#64513: HTML_Processor gets wrong breadcrumbs for elements in <head>
--------------------------+----------------------
 Reporter:  vicobot       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  HTML API      |     Version:  6.9
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by dmsnell):

 * keywords:  close =>
 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 oops, I was prepping my response while @westonruter was responding. to add
 to what he wrote, the difference between those methods is that
 `create_fragment()` is specifically designed to operate within the context
 of inner HTML inside a specified element, the default being `BODY`.

 > Use this for cases where you are processing chunks of HTML that will be
 found within a bigger HTML document, such as rendered block output that
 exists within a post, the_content inside a rendered site layout.

 If you use `create_full_parser()` it will assume that you are providing
 the full HTML for a page from start to finish and the initial `META`
 elements will appear within a `HEAD`. However, as
 [https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inhead
 per the HTML spec], when parsing a `META` tag, an element is to be created
 in the current element regardless of the parser’s current insertion mode.

 You can see this [https://software.hixie.ch/utilities/js/live-dom-
 viewer/?%3Cmeta%3E%3Cp%3Ebody%3Cmeta%3E demonstrated] using your browser’s
 interpretation of the HTML, where `META` remains inside the `BODY`

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


More information about the wp-trac mailing list