Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <html> |
michael@0 | 2 | <body> |
michael@0 | 3 | <p>This test does a few things: |
michael@0 | 4 | <ul> |
michael@0 | 5 | <li>It has a couple of: |
michael@0 | 6 | <ul> |
michael@0 | 7 | <li>Images: <IMG SRC="http://zabadubop/layers/tests/mzcolor.gif" ID="foo"> and |
michael@0 | 8 | <IMG SRC="http://peoplestage.netscape.com/kipp/nerdly_int.gif" NAME="kipp">. |
michael@0 | 9 | <li>Links to <a href="http://home.netscape.com">Netscape</a> and |
michael@0 | 10 | <A HREF="http://peoplestage.netscape.com/kipp">Kippy's Home Page</A>. |
michael@0 | 11 | <li>and Anchors to <a NAME="anchor1">here</A> and |
michael@0 | 12 | <A name="anchor2">here</a>. |
michael@0 | 13 | </ul> |
michael@0 | 14 | <li>It dumps (check the JS console) the images, links and anchors using |
michael@0 | 15 | the document.images, document.links and document.anchors arrays. |
michael@0 | 16 | <li>Then it removes one of the images. |
michael@0 | 17 | <li>Dumps the images array again. This is to prove that the images array |
michael@0 | 18 | is live. |
michael@0 | 19 | <li>Adds back the image. |
michael@0 | 20 | <li>And the dumps the images array again. The image arrays order should |
michael@0 | 21 | now be different. |
michael@0 | 22 | <li>It gets a list of LIs (using getElementsByTagName()) and prints |
michael@0 | 23 | out all their tagNames. There should be 10. |
michael@0 | 24 | </ul> |
michael@0 | 25 | <script> |
michael@0 | 26 | var x; |
michael@0 | 27 | dump("Images:\n"); |
michael@0 | 28 | for (x=0; x < document.images.length; x++) { |
michael@0 | 29 | dump("Image#" + x + ": " + document.images[x].getDOMAttribute("SRC") + "\n"); |
michael@0 | 30 | } |
michael@0 | 31 | dump("\nLinks:\n"); |
michael@0 | 32 | for (x=0; x < document.links.length; x++) { |
michael@0 | 33 | dump("Link#" + x + ": " + document.links[x].getDOMAttribute("HREF") + "\n"); |
michael@0 | 34 | } |
michael@0 | 35 | dump("\nAnchors:\n"); |
michael@0 | 36 | for (x=0; x < document.anchors.length; x++) { |
michael@0 | 37 | dump("Anchors#" + x + ": " + document.anchors[x].getDOMAttribute("NAME") + "\n"); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | dump("\nRemoving image\n"); |
michael@0 | 41 | var img=document.images[1]; |
michael@0 | 42 | var parent=img.parentNode; |
michael@0 | 43 | parent.removeChild(img); |
michael@0 | 44 | dump("Images:\n"); |
michael@0 | 45 | for (x=0; x < document.images.length; x++) { |
michael@0 | 46 | dump("Image#" + x + ": " + document.images[x].getDOMAttribute("SRC") + "\n"); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | dump("\nInserting image back into list\n"); |
michael@0 | 50 | var sib=parent.childNodes[0]; |
michael@0 | 51 | parent.insertBefore(img, sib); |
michael@0 | 52 | dump("Images:\n"); |
michael@0 | 53 | for (x=0; x < document.images.length; x++) { |
michael@0 | 54 | dump("Image#" + x + ": " + document.images[x].getDOMAttribute("SRC") + "\n"); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | var lis = document.getElementsByTagName("LI"); |
michael@0 | 58 | dump("Lists:\n"); |
michael@0 | 59 | for (x=0; x < lis.length; x++) { |
michael@0 | 60 | dump(lis[x].tagName + "\n"); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | dump("Named elements:\n"); |
michael@0 | 64 | dump(document.kipp.tagName + " with NAME=" + document.kipp.getDOMAttribute("NAME") + "\n"); |
michael@0 | 65 | |
michael@0 | 66 | </script> |
michael@0 | 67 | </body> |
michael@0 | 68 | </html> |