| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipa
ge/webappapis.html#eventhandler"> | 3 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipa
ge/webappapis.html#eventhandler"> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <div id="div"></div> | 7 <div id="div"></div> |
| 8 <script> | 8 <script> |
| 9 description("This test checks that EventHandler attributes only accept JS functi
ons as input."); | 9 description("This test checks that EventHandler attributes only accept JS functi
ons as input."); |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 shouldNotThrow('div.onkeydown = callback'); | 26 shouldNotThrow('div.onkeydown = callback'); |
| 27 shouldBe('div.onkeydown', 'callback'); | 27 shouldBe('div.onkeydown', 'callback'); |
| 28 shouldBe('callbackCount', '0'); | 28 shouldBe('callbackCount', '0'); |
| 29 dispatchKeyEvent(); | 29 dispatchKeyEvent(); |
| 30 shouldBe('callbackCount', '1'); | 30 shouldBe('callbackCount', '1'); |
| 31 | 31 |
| 32 // Non callable input should be treated as null. | 32 // Non callable input should be treated as null. |
| 33 var o = { handleEvent: callback }; | 33 var o = { handleEvent: callback }; |
| 34 shouldNotBe('div.onkeydown', 'null'); | 34 shouldNotBe('div.onkeydown', 'null'); |
| 35 shouldNotThrow('div.onkeydown = o'); | 35 shouldNotThrow('div.onkeydown = o'); |
| 36 shouldBeNull('div.onkeydown'); | 36 shouldBe('div.onkeydown', 'o'); |
| 37 dispatchKeyEvent(); | 37 dispatchKeyEvent(); |
| 38 shouldBe('callbackCount', '1'); | 38 shouldBe('callbackCount', '1'); |
| 39 | 39 |
| 40 // Test non-object assignment. |
| 41 shouldNotThrow('div.onkeydown = callback'); |
| 42 shouldBe('div.onkeydown', 'callback'); |
| 43 shouldNotThrow('div.onkeydown = "non-object"'); |
| 44 shouldBeNull('div.onkeydown'); |
| 45 |
| 40 // Test null assignment. | 46 // Test null assignment. |
| 41 shouldNotThrow('div.onkeydown = callback'); | 47 shouldNotThrow('div.onkeydown = callback'); |
| 42 shouldBe('div.onkeydown', 'callback'); | 48 shouldBe('div.onkeydown', 'callback'); |
| 43 shouldNotThrow('div.onkeydown = null'); | 49 shouldNotThrow('div.onkeydown = null'); |
| 44 shouldBeNull('div.onkeydown'); | 50 shouldBeNull('div.onkeydown'); |
| 45 </script> | 51 </script> |
| 46 </body> | 52 </body> |
| 47 </html> | 53 </html> |
| OLD | NEW |