|
| 1 | +<!doctype html> |
| 2 | +<meta charset=utf-8> |
| 3 | +<title>Interactions between indexed and named access on the Window object</title> |
| 4 | +<link rel=" author" title=" Delan Azabani" href=" [email protected]" > |
| 5 | +<link rel="help" href="https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts"> |
| 6 | +<link rel="help" href="https://html.spec.whatwg.org/multipage/#named-access-on-the-window-object"> |
| 7 | +<script src="/resources/testharness.js"></script> |
| 8 | +<script src="/resources/testharnessreport.js"></script> |
| 9 | +<div id=0></div> |
| 10 | +<div id=3></div> |
| 11 | +<iframe name=2></iframe> |
| 12 | +<iframe name=1></iframe> |
| 13 | +<script> |
| 14 | +const divs = document.querySelectorAll("div"); |
| 15 | +const iframes = document.querySelectorAll("iframe"); |
| 16 | +const wp = Object.getPrototypeOf(window); |
| 17 | +test(function() { |
| 18 | + assert_equals(window[0], iframes[0].contentWindow); |
| 19 | + assert_equals(window["0"], iframes[0].contentWindow); |
| 20 | +}, "WindowProxy: document-tree child navigable with index 0 (indexed access)"); |
| 21 | +test(function() { |
| 22 | + assert_equals(window[1], iframes[1].contentWindow); |
| 23 | + assert_equals(window["1"], iframes[1].contentWindow); |
| 24 | +}, "WindowProxy: document-tree child navigable with index 1 (indexed access)"); |
| 25 | +test(function() { |
| 26 | + assert_equals(window[2], iframes[0].contentWindow); |
| 27 | + assert_equals(window["2"], iframes[0].contentWindow); |
| 28 | +}, "WindowProxy: document-tree child navigable with target name 2 (named access)"); |
| 29 | +test(function() { |
| 30 | + assert_equals(window[3], divs[1]); |
| 31 | + assert_equals(window["3"], divs[1]); |
| 32 | +}, "WindowProxy: element with id 3 (named access)"); |
| 33 | +test(function() { |
| 34 | + assert_equals(wp[0], divs[0]); |
| 35 | + assert_equals(wp["0"], divs[0]); |
| 36 | +}, "Window prototype: element with id 0 (named access)"); |
| 37 | +test(function() { |
| 38 | + assert_equals(wp[1], iframes[1].contentWindow); |
| 39 | + assert_equals(wp["1"], iframes[1].contentWindow); |
| 40 | +}, "Window prototype: document-tree child navigable with target name 1 (named access)"); |
| 41 | +test(function() { |
| 42 | + assert_equals(wp[2], iframes[0].contentWindow); |
| 43 | + assert_equals(wp["2"], iframes[0].contentWindow); |
| 44 | +}, "Window prototype: document-tree child navigable with target name 2 (named access)"); |
| 45 | +test(function() { |
| 46 | + assert_equals(wp[3], divs[1]); |
| 47 | + assert_equals(wp["3"], divs[1]); |
| 48 | +}, "Window prototype: element with id 3 (named access)"); |
| 49 | +</script> |
0 commit comments