PureXML/Sources/HTML
Mihaela Mihaljevic 37bf30818f
perf(html): make HTML serialization depth-safe (#353)
`PureXML.HTML.serialize` walked an element's children recursively, so a
deeply-nested tree overflowed the stack (as shallow as a couple of thousand
deep on a Swift Task stack). The serializer now drives a deferred-close work
stack, the same shape as the XML serializer and `Canonicalizer.emit`: an
element pushes a close step then its children reversed, and a raw-text element
(`script`, `style`) flags its direct text children to emit verbatim, so nested
elements still serialize by their own name.

The output is byte-identical. Void-element, raw-text, comment, and escaping
semantics are unchanged (a new micro-test pins them) and the HTML conformance
corpus passes. A 50000-deep tree now serializes without crashing, guarded by
`HTMLSerializeDepthSafetyTests`. Part of #350.
2026-06-27 16:22:54 +02:00
..
HTMLAdoptionAgency.swift
HTMLDocumentBuilder.swift
HTMLEntities.swift
HTMLEntityTable1.swift
HTMLEntityTable2.swift
HTMLEntityTable3.swift
HTMLEntityTable.swift
HTMLForeignNames.swift
HTMLFosterParenting.swift
HTMLSerializer.swift perf(html): make HTML serialization depth-safe (#353) 2026-06-27 16:22:54 +02:00
HTMLToken.swift fix(html): percent-escape non-ASCII characters in URI-valued attributes (closes output32) (#263) 2026-06-24 03:27:49 +02:00
HTMLTokenizer.swift
HTMLTreeBuilder.swift fix(html): fragment parser reconstructs active formatting elements 2026-06-10 01:59:16 +02:00