Skip to content

Preserve xmlns attributes and rewrite the XML serialization algorithm - #772

Open
Ms2ger wants to merge 5 commits into
servo:mainfrom
Ms2ger:xmlns
Open

Preserve xmlns attributes and rewrite the XML serialization algorithm#772
Ms2ger wants to merge 5 commits into
servo:mainfrom
Ms2ger:xmlns

Conversation

@Ms2ger

@Ms2ger Ms2ger commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

In #586, it turned out that a targeted change to preserve xmlns attributes exposed issues in the XML serializer that caused test failures in Servo.
This change brings the XML serializer in line with the specification and mostly with other browsers.

The XML serializer needs to keep track of state related to namespaces and their prefixes.
Implementing this correctly is not workable using a unified trait between HTML and XML.
This is a breaking change: to serialize to XML, users now need to use the new xml5ever::serialize::XmlSerializer.

This implements the DOM Parsing and Serialization specification including the changes from w3c/DOM-Parsing#88.

Fixes #569.

Co-authored-by: Josh Matthews josh@joshmatthews.net
Co-authored-by: Devon Govett devongovett@gmail.com

Ms2ger added 2 commits August 17, 2026 20:16
In servo#586, it turned out that a targeted change to preserve xmlns attributes exposed issues in the XML serializer that caused test failures in Servo.
This change brings the XML serializer in line with the specification and mostly with other browsers.

The XML serializer needs to keep track of state related to namespaces and their prefixes.
Implementing this correctly is not workable using a unified trait between HTML and XML.
This is a breaking change: to serialize to XML, users now need to use the new xml5ever::serialize::XmlSerializer.

This implements the DOM Parsing and Serialization specification including the changes from <w3c/DOM-Parsing#88>.

Fixes servo#569.

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Devon Govett <devongovett@gmail.com>

Signed-off-by: Ms2ger <Ms2ger@gmail.com>
@Ms2ger

Ms2ger commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Depends on Ygg01/xml5lib-tests#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

V-non-breaking A non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xmlns-prefixed attribute on root element is lost

1 participant