| <html> |
| <head> |
| <script> |
| function debug(str) { |
| var c = document.getElementById('console') |
| c.innerHTML += (str + "<br>") |
| } |
| |
| function runTests() { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| debug('document.all: ' + document.all) |
| |
| if (document.all) { |
| debug('FAILURE: document.all should evaluate to false') |
| return; |
| } |
| |
| if (!document.all) { |
| // Do nothing |
| } else { |
| debug('FAILURE: document.all should evaluate to false') |
| return; |
| } |
| if (document.all != undefined) { |
| debug('FAILURE: document.all != undefined should evaluate to false ') |
| return; |
| } |
| |
| if (undefined != document.all) { |
| debug('FAILURE: undefined != document.all should evaluate to false ') |
| return; |
| } |
| |
| if (document.all != null) { |
| debug('FAILURE: document.all != null should evaluate to false') |
| return; |
| } |
| |
| if (null != document.all) { |
| debug('FAILURE: null != document.all should evaluate to false') |
| return; |
| } |
| |
| // Try replacing document.all with something else |
| document.all = { 'foo': 42} |
| |
| if (document.all.foo != 42) { |
| debug('FAILURE: replacing document.all did not work') |
| return; |
| } |
| |
| // Delete new document.all |
| delete(document.all) |
| |
| if (document.all.foo != undefined) { |
| debug('FAILURE: deleting replace document.all did not work') |
| return; |
| } |
| |
| // Check typeof document.all |
| if (typeof document.all != 'undefined') { |
| debug('FAILURE: typeof document.all should be undefined'); |
| return; |
| } |
| |
| debug('SUCCESS!') |
| } |
| </script> |
| </head> |
| <body onload="runTests();"> |
| This tests that document.all should be undetectable, and that it should be possible to set document.all to something else. If this test is successful, the text "SUCCESS" should be shown below. |
| <pre id="console"></pre> |
| </body> |
| </html> |