| <html> |
| <!-- This tests that a base element is respected in rendering anchors on viewsource page. --> |
| <head> |
| <script> |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.waitUntilDone(); |
| } |
| |
| function checkFrame(id) { |
| var frame = document.getElementById(id); |
| |
| // Update this list when you modified resources/viewsource-frame-{3,4}.html . |
| var expected = [ |
| // This will be matched with the href in the base element. |
| [ "http://example.org/foo/", "http://example.org/foo/" ], |
| [ "bar", "http://example.org/foo/bar" ], |
| [ "/bar", "http://example.org/bar" ], |
| // This shouldn't be affected. |
| [ "http://example.org/foobar", "http://example.org/foobar" ] |
| ]; |
| |
| var elements = frame.contentDocument.documentElement.getElementsByTagName("a"); |
| if (!elements || elements.length !== 4) { |
| return false; |
| } |
| |
| var ok = true; |
| for (var i = 0; i < elements.length; ++i) { |
| var element = elements.item(i); |
| if (element.innerHTML !== expected[i][0] || element.href !== expected[i][1]) { |
| ok = false; |
| break; |
| } |
| } |
| return ok; |
| } |
| |
| function report() { |
| var resultText = "FAIL"; |
| // Check that links are added on href values regardless of the case of tag names. |
| if (checkFrame("lower") && checkFrame("upper")) { |
| resultText = "PASS"; |
| } |
| if (window.layoutTestController) { |
| document.open(); |
| document.write(resultText); |
| document.close(); |
| |
| layoutTestController.notifyDone(); |
| } else { |
| document.getElementById("result").textContent = resultText; |
| } |
| } |
| </script> |
| </head> |
| <body onload="report()"> |
| <p> |
| In a frame below which is in 'view source' mode, each link on the value of the |
| href attribute in anchor elements must have the same address as the anchor |
| element's contents. |
| </p> |
| <hr> |
| <iframe viewsource src="resources/viewsource-frame-3.html" width="600" id="lower"></iframe> |
| <iframe viewsource src="resources/viewsource-frame-4.html" width="600" id="upper"></iframe> |
| <hr> |
| <div id="result"></div> |
| </body> |
| </html> |