Context
Discovered during Issue #51 follow-up review. Filed as a known limitation of the v1 canonicalizer.
Problem
When an SVG uses namespace-prefixed attributes on child elements (e.g. xlink:href on <use>), @xmldom/xmldom may re-declare namespace prefixes on child elements during serialization. This can produce non-canonical output for SVGs that use xmlns:xlink or other namespace prefixes beyond the base xmlns.
Current behavior (locked in by test)
The xlink:href probe in the existing test suite shows that xmlns:xlink currently appears exactly once (on root) with no child re-declaration — this is the stable case. However, more complex namespace usage (multiple prefixed attributes, deeply nested elements, mixed namespace scopes) has not been tested and may produce redundant xmlns: declarations.
Why deferred
- SequenceForge's own SVG output does not use
xlink: or other namespace prefixes — this is a future-consumer concern
- Fixing this requires either a post-serialization namespace deduplication pass or replacing
XMLSerializer with a custom serializer
- The v1 canonicalizer is correct for all current SequenceForge SVG output
Gate condition for this issue
The existing known-limitation test in sequence-builder.canonicalize.test.js must be updated (or extended) when this is fixed. The test name is:
Known limitation: xlink namespace on use element canonicalizes without redundant re-declaration
Out of scope here
d, viewBox, transform, points numeric normalization (separate v2 issue)
- Default attribute elision
References
Context
Discovered during Issue #51 follow-up review. Filed as a known limitation of the v1 canonicalizer.
Problem
When an SVG uses namespace-prefixed attributes on child elements (e.g.
xlink:hrefon<use>),@xmldom/xmldommay re-declare namespace prefixes on child elements during serialization. This can produce non-canonical output for SVGs that usexmlns:xlinkor other namespace prefixes beyond the basexmlns.Current behavior (locked in by test)
The
xlink:hrefprobe in the existing test suite shows thatxmlns:xlinkcurrently appears exactly once (on root) with no child re-declaration — this is the stable case. However, more complex namespace usage (multiple prefixed attributes, deeply nested elements, mixed namespace scopes) has not been tested and may produce redundantxmlns:declarations.Why deferred
xlink:or other namespace prefixes — this is a future-consumer concernXMLSerializerwith a custom serializerGate condition for this issue
The existing known-limitation test in
sequence-builder.canonicalize.test.jsmust be updated (or extended) when this is fixed. The test name is:Out of scope here
d,viewBox,transform,pointsnumeric normalization (separate v2 issue)References