PureXML/Sources/HTML
Mihaela Mihaljevic 74bf622275
fix(html): percent-escape non-ASCII characters in URI-valued attributes (closes output32) (#263)
* fix(html): percent-escape non-ASCII characters in URI-valued attributes

XSLT 1.0 16.2 / HTML 4.01 B.2.1: the html output method percent-escapes
non-ASCII and control characters in attributes of type %URI (href, src, cite,
action, and the rest), writing each as the uppercase hex of its UTF-8 bytes,
while keeping " and & as entities. Other attributes are unaffected. The
serializer left such characters unescaped. Grounded in the libxml2
htmlSerializeUri study; reimplemented in pure Swift, no Foundation.

Closes Apache Xalan conformance case output32.

* docs(html): disclose URI-attribute escaping round-trip normalization

Address the URI-escaping critics: the html serializer follows libxml2's HTML
output model where URI-valued attributes are always percent-escaped, so a
parse-then-serialize round-trip normalizes a space or non-ASCII byte to %HH.
Document that this is idempotent (a literal % is left as is) and that every
space is escaped (leading ones included, where libxml2 skips them). Add an
idempotency test.
2026-06-24 03:27:49 +02:00
..
HTMLAdoptionAgency.swift
HTMLDocumentBuilder.swift
HTMLEntities.swift
HTMLEntityTable1.swift
HTMLEntityTable2.swift
HTMLEntityTable3.swift
HTMLEntityTable.swift
HTMLForeignNames.swift
HTMLFosterParenting.swift
HTMLSerializer.swift fix(html): percent-escape non-ASCII characters in URI-valued attributes (closes output32) (#263) 2026-06-24 03:27:49 +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