| <html> |
| <head> |
| <link rel="stylesheet" href="../../js/resources/js-test-style.css"> |
| <script src="../../js/resources/js-test-pre.js"></script> |
| <script type="text/javascript" src="resources/window-properties.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| |
| <br> |
| <iframe src="about:blank"></iframe> |
| |
| <br> |
| <form> |
| <input id="MYINPUT" value="Hello World" type="text"/> |
| </form> |
| |
| <div id="console"></div> |
| |
| <script> |
| description('Tests lookup precedence for properties on DOMWindow objects in the presence of a child frame, and that IDL properties defined in the prototype (window.location, window.focus, etc) have higher lookup precedence than named document elements (such as input elements).'); |
| |
| var win = window.window; |
| var myInput = document.getElementById("MYINPUT"); |
| var subframe = win.frames[0]; |
| |
| function checkValue(name, original) { |
| // Handle a correct Location, as well as any numerical values (screenX and |
| // so on), separately to avoid depending on the test file or window |
| // location. |
| if ((name.toLowerCase() == "location" || typeof original == "number") |
| && win[name] == original) |
| testPassed("win['" + name + "'] matched original"); |
| else |
| shouldEvaluateTo("win['" + name + "']", original); |
| } |
| |
| function check(prop) { |
| var name = prop[0]; |
| var original = win[name]; |
| // Check subframe precedence. |
| try { |
| subframe[name] = name; |
| } catch (e) { |
| debug("Unable to set subframe[" + name + "]: " + e); |
| } |
| checkValue(name, original); |
| |
| // Check prototype precedence. |
| myInput.setAttribute("id", name); |
| checkValue(name, original); |
| } |
| |
| for (var i = 0; i < propertyInfo.length; ++i) { |
| check(propertyInfo[i]); |
| } |
| |
| var successfullyParsed = true; |
| </script> |
| <script src="../../js/resources/js-test-post.js"></script> |
| </body> |
| </html> |