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