Skip to content

Conversation

@odzhychko
Copy link
Contributor

@odzhychko odzhychko commented Mar 30, 2025

I noticed two inconsistencies in XML serialization between different browsers.

The first I fixed in a10ba02.
The other I just documented after configuring tests to run with different browsers in f716398.

Feel free to apply these changes if you find them useful.
Or just close this PR when you don't need them.

Previously generated XML was valid, but the generated namespace IDs for namespaces of attributes differed between different browsers.

For example, the following code produces different results in different browsers:

```javascript
XMLUtility.serialize({
			name: ['myNs1', 'element'],
			attributes: [['myNs2', 'abc', '123']]
		}
```

In Chrome it generated `<x0:element xmlns:x0="myNs1" xmlns:ns1="myNs2" ns1:abc="123"/>`.
And in Firefox it generated `<x0:element xmlns:x0="myNs1" a0:abc="123" xmlns:a0="myNs2"/>`.
One used the prefix `ns1` and the other used `a0`.

Signed-off-by: Oleksandr Dzhychko <[email protected]>
Running test with Chromium and WebKit surfaced non-breaking inconsistencies in XML serialization. They might catch other issues in the future.

Signed-off-by: Oleksandr Dzhychko <[email protected]>
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks a lot.

I amended the commit to replace spaces with tabs.

@st3iny st3iny added enhancement New feature or request 4. to release Ready to be released and/or waiting for tests to finish labels Mar 31, 2025
@st3iny st3iny merged commit 7bb6bfd into nextcloud:main Mar 31, 2025
8 checks passed
@odzhychko odzhychko deleted the serialize-attribute-prefixes-consistently-across-browsers branch March 31, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants