[wp-trac] [WordPress Trac] #62270: Unable to set bookmark on </body> in WP_HTML_Processor
WordPress Trac
noreply at wordpress.org
Wed Oct 23 17:18:57 UTC 2024
#62270: Unable to set bookmark on </body> in WP_HTML_Processor
----------------------------+------------------------------
Reporter: westonruter | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTML API | Version: 6.4
Severity: normal | Resolution:
Keywords: has-unit-tests | Focuses:
----------------------------+------------------------------
Changes (by westonruter):
* keywords: has-patch has-unit-tests => has-unit-tests
Comment:
Replying to [comment:4 jonsurrell]:
> In most cases (except whitespace text or comments) the injected HTML
would actually be inside the BODY tag in the tree, but the HTML is
undesirable.
That's a good point. In my subclass, if a bookmark is unable to be set on
`</body>` then it could just opt to append the injected content at the end
of the document after `</html>` instead of inserting it at the desired
bookmark before `</body>`.
Alternatively, I guess I could print out a comment at `wp_footer()` and
then when iterating over the tokens and this comment is detected, the "end
of body" bookmark could be set at that point.
These should be viable workarounds until setting a bookmark on `</body>`
is supported.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62270#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list