mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Bug 169521: fix XML attribute serialization for proper roundtripping r=bz
This is due to incomplete specification, see discussion on Chromium bug https://bugs.chromium.org/p/chromium/issues/detail?id=418531 Behavior is now in line with Edge and Chromium. MozReview-Commit-ID: AxIRtIj5j8r --HG-- extra : rebase_source : 45c8016537259c7d7a2af6e8b8a9f5a25521e4c5
This commit is contained in:
parent
6a5db0ee6c
commit
23dc66c6b8
@ -1209,8 +1209,8 @@ static const uint8_t kEntities[] = {
|
||||
|
||||
// This table indexes into kEntityStrings[].
|
||||
static const uint8_t kAttrEntities[] = {
|
||||
_, _, _, _, _, _, _, _, _, _,
|
||||
_, _, _, _, _, _, _, _, _, _,
|
||||
_, _, _, _, _, _, _, _, _, 5,
|
||||
6, _, _, 7, _, _, _, _, _, _,
|
||||
_, _, _, _, _, _, _, _, _, _,
|
||||
_, _, _, _, 1, _, _, _, 2, _,
|
||||
_, _, _, _, _, _, _, _, _, _,
|
||||
@ -1226,6 +1226,9 @@ static const char* const kEntityStrings[] = {
|
||||
/* 2 */ "&",
|
||||
/* 3 */ "<",
|
||||
/* 4 */ ">",
|
||||
/* 5 */ "	",
|
||||
/* 6 */ "
",
|
||||
/* 7 */ "
",
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -39,6 +39,15 @@ test(function() {
|
||||
var xmlString = (new XMLSerializer()).serializeToString(root);
|
||||
assert_equals(xmlString, '<root xmlns="urn:bar"><outer xmlns=""><inner>value1</inner></outer></root>');
|
||||
}, 'Check if there is no redundant empty namespace declaration.');
|
||||
|
||||
test(function() {
|
||||
var serializer = new XMLSerializer();
|
||||
var root = createXmlDoc().documentElement;
|
||||
root.firstChild.setAttribute('attr1', 'value1\tvalue2\r\n');
|
||||
var xmlString = serializer.serializeToString(root);
|
||||
assert_equals(xmlString, '<root><child1 attr1="value1	value2
">value1</child1></root>');
|
||||
}, 'check XMLSerializer.serializeToString escapes attribute values for roundtripping');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user