Files
sousa-gecko/testing/web-platform/tests/xml/xml-prolog-accepted-versions.html
T
David Baron ea4fba40b4 Bug 1998491 [wpt PR 55870] - Add test for the version part of the XML prolog., a=testonly
Automatic update from web-platform-tests
Add test for the version part of the XML prolog.

Bug: 441911594
Change-Id: Ie0662f30fa390077578fe8d0deff43e26db7d8c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7118800
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1540530}

--

wpt-commits: e5b8b3e712dd4f0e32e811ccd6f395953620fbb0
wpt-pr: 55870
2025-11-10 09:59:29 +00:00

98 lines
2.9 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>Accepted versions in XML prolog</title>
<link rel="help" href="https://www.w3.org/TR/REC-xml/#sec-prolog-dtd">
<meta name="assert" content="VersionNum production accepts any 1.x version">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
function string_to_xml_document(s) {
let parser = new DOMParser();
return parser.parseFromString(s, 'text/xml');
}
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.0"?>
<a></a>`
).documentElement.tagName,
"a");
}, "XML 1.0 is accepted");
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.1"?>
<b></b>`
).documentElement.tagName,
"b");
}, "XML 1.1 is accepted");
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.2"?>
<c></c>`
).documentElement.tagName,
"c");
}, "XML 1.2 is accepted");
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.7"?>
<d></d>`
).documentElement.tagName,
"d");
}, "XML 1.7 is accepted");
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.1075"?>
<e></e>`
).documentElement.tagName,
"e");
}, "XML 1.1075 is accepted");
test(function() {
assert_equals(string_to_xml_document(
`<?xml version="1.000"?>
<f></f>`
).documentElement.tagName,
"f");
}, "XML 1.000 is accepted");
test(function() {
assert_not_equals(string_to_xml_document(
`<?xml version="10.0"?>
<x></x>`
).documentElement.tagName,
"x");
}, "XML 10.0 is NOT accepted");
test(function() {
assert_not_equals(string_to_xml_document(
`<?xml version="100"?>
<x></x>`
).documentElement.tagName,
"x");
}, "XML 100 is NOT accepted");
test(function() {
assert_not_equals(string_to_xml_document(
`<?xml version="2.0"?>
<x></x>`
).documentElement.tagName,
"x");
}, "XML 2.0 is NOT accepted");
test(function() {
assert_not_equals(string_to_xml_document(
`<?xml version="17.0"?>
<x></x>`
).documentElement.tagName,
"x");
}, "XML 17.0 is NOT accepted");
</script>