base_href_unspecified.html (1224B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: base_href_unspecified</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 <base id="base" target="_blank"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <div id="log"></div> 11 <img id="test" src="/images/blue-100x100.png" style="display:none"> 12 13 <script> 14 var testElement, 15 baseElement; 16 17 setup(function () { 18 testElement = document.getElementById("test"); 19 baseElement = document.getElementById("base"); 20 }); 21 22 test(function() { 23 assert_equals(baseElement.href, document.location.href, "Return the document base URL if the base element has no href content attribute."); 24 }, "The value of the href attribute must be the document's address if it is unspecified"); 25 26 test(function() { 27 var exp = testElement.src.substring(0, testElement.src.lastIndexOf("/images/blue-100x100.png") + 1); 28 assert_true(baseElement.href.indexOf(exp) != -1, "The src attribute of the img element is incorrect."); 29 }, "The src attribute of the img element must relative to document's address"); 30 </script>