Make WordPress Core

Opened 7 months ago

Closed 4 months ago

#62583 closed enhancement (fixed)

Ensure HTML Processor step adds to element_queue

Reported by: jonsurrell's profile jonsurrell Owned by: gziolo's profile gziolo
Milestone: 6.8 Priority: normal
Severity: normal Version: 6.6
Component: HTML API Keywords: has-patch
Focuses: Cc:

Description

There are some cases where the step functions in the HTML processor return true, but do not add anything to the element queue. When step returns true, it should indicate the progress has been made progressing the document and there are tokens to process.

There is a todo in code right now describing this situation:

In some cases, probably related to the adoption agency
algorithm, this call to step() doesn't create any new
events. Calling it again creates them. Figure out why
this is and if it's inherent or if it's a bug. Looping
until there are events or until there are no more
tokens works in the meantime and isn't obviously wrong.

Change History (12)

This ticket was mentioned in PR #7627 on WordPress/wordpress-develop by @jonsurrell.


7 months ago
#1

  • Keywords has-patch added

The HTML specification does not close HTML or BODY tags (pop them off the stack of open elements) when their tag closers are encountered. The HTML processor correctly handles this behavior, however it "pauses" by returning true from the step functions. This behavior is incorrect behavior for step because there are no additional tokens to be processed (nothing has been added to the element queue).

When encountering these closers, internal state is updated correctly, but the parser should continue processing without pausing.

Trac ticket: https://core.trac.wordpress.org/ticket/62583

This ticket was mentioned in PR #7904 on WordPress/wordpress-develop by @jonsurrell.


7 months ago
#2

  • Proceed past BODY and HTML close tags
  • DROPME: Add exception in failure case
  • Do not return true when closing HTML (but not popping off stack)
  • Do not return from step if active formatting POP did not occur
  • Do not return from foreign tag closer if stack not modified

Trac ticket:

#3 @gziolo
7 months ago

  • Owner set to gziolo
  • Resolution set to fixed
  • Status changed from new to closed

In 59500:

HTML API: Step past closing HTML, BODY tags

The HTML specification does not close HTML or BODY tags (pop them off the stack of open elements) when their tag closers are encountered. The HTML processor correctly handled this behavior, however it incorrectly "paused" by returning true from the step functions.

Props jonsurrell, dmsnell, gziolo.
Fixes #62583.

#5 @gziolo
7 months ago

  • Milestone changed from Awaiting Review to 6.8

#6 @jonsurrell
7 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

PR 7904 contains more cases for consideration (although it's not yet ready for review). Reopening.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


4 months ago

#8 @audrasjb
4 months ago

As per today's bugscrub: This ticket was committed and reopened to handle further use case, so we'll keep it open in the milestone for now, but can we have a status update on the remaining work @gziolo @jonsurrell? It would be nice to get this closed before beta 1 next week. Thanks!

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


4 months ago

#10 @jonsurrell
4 months ago

There is some valid work in PR 7904, but I don't expect that work to be finished or merged in 6.8. The changes in that PR are not essential and are fine to bump to a future release.

I'm not sure what the preferred approach is. Would it be best to close this ticket with the changes that are already merged, then open another ticket with the ongoing work is ready to continue?

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


4 months ago

#12 @audrasjb
4 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Yes, let's close this ticket as fixed then. Follow-up ticket can be opened for further changes.

Note: See TracTickets for help on using tickets.