| OLD | NEW |
| (Empty) |
| 1 <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 2 <head> | |
| 3 <script>window.enablePixelTesting = true;</script> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | |
| 8 <text id="text1" x="500 1000 1500" y="50"> ABC </text> | |
| 9 <text id="reference" x="50 100" y="100"> ABC </text> | |
| 10 </svg> | |
| 11 | |
| 12 <p id="description"></p> | |
| 13 <div id="console"></div> | |
| 14 <script type="text/javascript"> | |
| 15 <![CDATA[ | |
| 16 description("This is a test how SVGLengthList reacts to XML DOM modification
s."); | |
| 17 | |
| 18 var text1 = document.getElementById("text1"); | |
| 19 shouldBe("text1.x.baseVal.numberOfItems", "3"); | |
| 20 | |
| 21 var text1XBaseValGetItem0 = text1.x.baseVal.getItem(0); | |
| 22 var text1XBaseValGetItem1 = text1.x.baseVal.getItem(1); | |
| 23 var text1XBaseValGetItem2 = text1.x.baseVal.getItem(2); | |
| 24 | |
| 25 shouldBe("text1XBaseValGetItem0.value", "500"); | |
| 26 shouldBe("text1XBaseValGetItem1.value", "1000"); | |
| 27 shouldBe("text1XBaseValGetItem2.value", "1500"); | |
| 28 | |
| 29 debug(""); | |
| 30 debug("Setting x = x - 250 on all three items"); | |
| 31 | |
| 32 text1XBaseValGetItem0.value -= 250; | |
| 33 text1XBaseValGetItem1.value -= 250; | |
| 34 text1XBaseValGetItem2.value -= 250; | |
| 35 | |
| 36 shouldBe("text1XBaseValGetItem0.value", "250"); | |
| 37 shouldBe("text1XBaseValGetItem1.value", "750"); | |
| 38 shouldBe("text1XBaseValGetItem2.value", "1250"); | |
| 39 | |
| 40 debug(""); | |
| 41 debug("Now using text.setAttribute('x', '50 100')"); | |
| 42 text1.setAttribute("x", "50 100"); | |
| 43 | |
| 44 debug(""); | |
| 45 debug("Assure that the wrappers still point to the OLD values"); | |
| 46 shouldBe("text1XBaseValGetItem0.value", "250"); | |
| 47 shouldBe("text1XBaseValGetItem1.value", "750"); | |
| 48 shouldBe("text1XBaseValGetItem2.value", "1250"); | |
| 49 | |
| 50 debug(""); | |
| 51 debug("Assure that obtaining new wrappers will give the right NEW values"); | |
| 52 shouldBe("text1.x.baseVal.numberOfItems", "2"); | |
| 53 shouldBe("text1.x.baseVal.getItem(0).value", "50"); | |
| 54 shouldBe("text1.x.baseVal.getItem(1).value", "100"); | |
| 55 | |
| 56 debug(""); | |
| 57 debug("Setting x = x + 100 on all old wrapper items"); | |
| 58 text1XBaseValGetItem0.value += 100; | |
| 59 text1XBaseValGetItem1.value += 100; | |
| 60 text1XBaseValGetItem2.value += 100; | |
| 61 | |
| 62 debug(""); | |
| 63 debug("Assure that the old wrappers can still be modified, but don't influen
ce the new wrappers"); | |
| 64 shouldBe("text1XBaseValGetItem0.value", "350"); | |
| 65 shouldBe("text1XBaseValGetItem1.value", "850"); | |
| 66 shouldBe("text1XBaseValGetItem2.value", "1350"); | |
| 67 | |
| 68 debug(""); | |
| 69 debug("Assure that the new wrappers stayed the same"); | |
| 70 shouldBe("text1.x.baseVal.numberOfItems", "2"); | |
| 71 shouldBe("text1.x.baseVal.getItem(0).value", "50"); | |
| 72 shouldBe("text1.x.baseVal.getItem(1).value", "100"); | |
| 73 | |
| 74 debug(""); | |
| 75 debug("The test passes if you only see 'PASS' messages, and both elements on
top look the same"); | |
| 76 debug(""); | |
| 77 | |
| 78 ]]> | |
| 79 </script> | |
| 80 </body> | |
| 81 </html> | |
| OLD | NEW |