document_location.html (1305B)
1 <!doctype html> 2 <title>document.location</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id="log"></div> 6 <script> 7 test(function() { 8 var doc = document.implementation.createHTMLDocument(""); 9 assert_equals(doc.location, null); 10 }, "document not in a browsing context"); 11 12 test(function() { 13 assert_equals(document.location, location); 14 }, "document.location equals window.location"); 15 16 test(function() { 17 var desc1 = Object.getOwnPropertyDescriptor(new Document(), "location"); 18 assert_not_equals(desc1, undefined); 19 assert_equals(typeof desc1.get, "function"); 20 21 var desc2 = Object.getOwnPropertyDescriptor(new Document(), "location"); 22 assert_not_equals(desc2, undefined); 23 assert_equals(typeof desc2.get, "function"); 24 25 assert_equals(desc1.get, desc2.get); 26 }, "Attribute getter deduplication"); 27 28 test(function() { 29 var desc1 = Object.getOwnPropertyDescriptor(new Document(), "location"); 30 assert_not_equals(desc1, undefined); 31 assert_equals(typeof desc1.set, "function"); 32 33 var desc2 = Object.getOwnPropertyDescriptor(new Document(), "location"); 34 assert_not_equals(desc2, undefined); 35 assert_equals(typeof desc2.set, "function"); 36 37 assert_equals(desc1.set, desc2.set); 38 }, "Attribute setter deduplication"); 39 </script>