1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
4 <body onload=
"onPageLoad()">
5 <p>Test of Range.createContextualFragment() with in-scope namespace prefixes, where the XML fragment introduces additional namespace prefixes. If the test succeeds you will see the word
"PASS" below.
</p>
6 <p id=
"result">Running test...
</p>
7 <svg:svg xmlns:
svg=
"http://www.w3.org/2000/svg" xmlns:
xlink=
"http://www.w3.org/1999/xlink">
10 <script type=
"text/javascript">//<![CDATA[
11 function onPageLoad() {
12 if (window.testRunner)
13 testRunner.dumpAsText();
15 var result = document.getElementById(
"result");
17 var defs = document.getElementById(
"defs"),
18 range = document.createRange(),
21 range.setStart(defs,
0);
22 docFragment = range.createContextualFragment(
"<svg:linearGradient id='gradient1'/>" +
23 "<a:aTest id='aTest' xmlns:a='urn:x-test:a' xmlns:b='urn:x-test:b' a:aAttr='aValue' xlink:href='#gradient1'>" +
24 " <b:bTest id='bTest' a:aAttr='aValue2' b:bAttr='bValue'>" +
25 " <xlink:testRedefiningXlink id='testRedefiningXlink' xlink:xlinkAttr='xlinkValue' xmlns:xlink='urn:x-test:xlink'/>" +
26 " <svg:linearGradient id='gradient2' xlink:href='#gradient1'/>" +
29 defs.appendChild(docFragment);
31 var gradient1 = document.getElementById(
"gradient1");
32 if (gradient1.namespaceURI !=
"http://www.w3.org/2000/svg") {
33 result.textContent += ' - #gradient1 has the wrong namespaceURI';
37 var aTest = document.getElementById(
"aTest");
38 if (aTest.namespaceURI !=
"urn:x-test:a") {
39 result.textContent += ' - #aTest has the wrong namespaceURI';
42 if (aTest.getAttributeNS(
"urn:x-test:a",
"aAttr") !=
"aValue") {
43 result.textContent += ' - wrong value for the a:aAttr attribute of #aTest';
46 if (aTest.getAttributeNS(
"http://www.w3.org/1999/xlink",
"href") !=
"#gradient1") {
47 result.textContent += ' - wrong value for the xlink:href attribute of #aTest';
51 var bTest = document.getElementById(
"bTest");
52 if (bTest.namespaceURI !=
"urn:x-test:b") {
53 result.textContent += ' - #bTest has the wrong namespaceURI';
56 if (bTest.getAttributeNS(
"urn:x-test:a",
"aAttr") !=
"aValue2") {
57 result.textContent += ' - wrong value for the a:aAttr attribute of #bTest';
60 if (bTest.getAttributeNS(
"urn:x-test:b",
"bAttr") !=
"bValue") {
61 result.textContent += ' - wrong value for the b:bAttr attribute of #bTest';
65 var testRedefiningXlink = document.getElementById(
"testRedefiningXlink");
66 if (testRedefiningXlink.namespaceURI !=
"urn:x-test:xlink") {
67 result.textContent += ' - #testRedefiningXlink has the wrong namespaceURI';
70 if (testRedefiningXlink.getAttributeNS(
"urn:x-test:xlink",
"xlinkAttr") !=
"xlinkValue") {
71 result.textContent += ' - wrong value for the xlink:xlinkAttr attribute of #testRedefiningXlink';
75 var gradient2 = document.getElementById(
"gradient2");
76 if (gradient2.namespaceURI !=
"http://www.w3.org/2000/svg") {
77 result.textContent += ' - #gradient2 has the wrong namespaceURI';
80 if (gradient2.getAttributeNS(
"http://www.w3.org/1999/xlink",
"href") !=
"#gradient1") {
81 result.textContent += ' - wrong value for the xlink:href attribute of #gradient2';
85 if (result.textContent ===
"Running test...")
86 result.textContent =
"PASS";