[wp-trac] [WordPress Trac] #64394: HTML Processor may error processing nested HTML structures

WordPress Trac noreply at wordpress.org
Wed Dec 10 16:15:18 UTC 2025


#64394: HTML Processor may error processing nested HTML structures
--------------------------+------------------------------
 Reporter:  jonsurrell    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTML API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dmsnell):

 Is this specifically about nesting depth? Or it could occur also for
 documents with certain specific kinds of tags. I think a reasonable option
 in any case is to catch and abort in these cases, but we might want to
 examine the throwing behavior of the underlying Tag Processor 🤷‍♂️

 There are discussions about [https://github.com/whatwg/html/issues/3732
 capping nesting depth] in the spec itself, so we should try to align over
 time with that. According to this discussion, there are already limits in
 Safari, Firefox, and Chrome. We could potentially adjust our arbitrary
 limit to match those.

 > Chrome&Firefox the max depth is 513, while in Safari it is 512

 Also interesting from that issue is this note

 > at some point it stops nesting elements, and instead adds them at
 sibling. In all browser, there is some MAX_DEPTH, and if the stack of open
 elements has already a length of MAX_DEPTH then before pushing a new
 element to the stack they'll pop the previous one

 Of course this isn’t specified behavior, but it certainly establishes a
 baseline for expectations we could follow.

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


More information about the wp-trac mailing list