base_href_specified.html (1210B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: base_href_specified</title> 4 <link rel="author" title="Intel" href="http://www.intel.com/"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-base-element"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/common/get-host-info.sub.js"></script> 9 <base id="base"> 10 <div id="log"></div> 11 <img id="test" src="test.ico" style="display:none"> 12 13 <script> 14 var testElement; 15 var baseElement; 16 17 var otherOrigin = get_host_info().HTTP_REMOTE_ORIGIN; 18 19 setup(function() { 20 testElement = document.getElementById("test"); 21 baseElement = document.getElementById("base"); 22 23 baseElement.setAttribute("href", otherOrigin); 24 }); 25 26 test(function() { 27 assert_equals(baseElement.href, otherOrigin + "/", "The href attribute of the base element is incorrect."); 28 }, "The href attribute of the base element is specified"); 29 30 test(function() { 31 assert_equals(testElement.src, otherOrigin + "/test.ico", "The src attribute of the img element is incorrect."); 32 }, "The src attribute of the img element must relative to the href attribute of the base element"); 33 </script>