| OLD | NEW |
| 1 <head> | 1 <head> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
| 3 </head> | 3 </head> |
| 4 <body> | 4 <body> |
| 5 <script> | 5 <script> |
| 6 description("This tests that document.createEvent is hooked up for all Event
interfaces (and alternatives) and creates the right instance.") | 6 description("This tests that document.createEvent is hooked up for all Event
interfaces (and alternatives) and creates the right instance.") |
| 7 | 7 |
| 8 // AnimationEvent | 8 // AnimationEvent |
| 9 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Anima
tionEvent"); | 9 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Anima
tionEvent"); |
| 10 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event
"); | 10 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event
"); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // DeviceOrientationEvent | 219 // DeviceOrientationEvent |
| 220 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.DeviceOrientationEvent"); | 220 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.DeviceOrientationEvent"); |
| 221 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.Event"); | 221 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.Event"); |
| 222 // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor
=== window.DeviceOrientationEvent"); | 222 // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor
=== window.DeviceOrientationEvent"); |
| 223 | 223 |
| 224 // OrientationEvent (Event alternative) | 224 // OrientationEvent (Event alternative) |
| 225 // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.
Event"); | 225 // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.
Event"); |
| 226 // shouldBeTrue("document.createEvent('OrientationEvent').constructor === wi
ndow.Event"); | 226 // shouldBeTrue("document.createEvent('OrientationEvent').constructor === wi
ndow.Event"); |
| 227 | 227 |
| 228 // AutocompleteErrorEvent | |
| 229 shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof wind
ow.AutocompleteErrorEvent"); | |
| 230 shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof wind
ow.Event"); | |
| 231 shouldBeTrue("document.createEvent('AutocompleteErrorEvent').constructor ===
window.AutocompleteErrorEvent"); | |
| 232 | |
| 233 // We test both a hard coded set and the automated set below (using enumerat
ion) to ensure that a constructor being removed | 228 // We test both a hard coded set and the automated set below (using enumerat
ion) to ensure that a constructor being removed |
| 234 // from the window is caught a regression. | 229 // from the window is caught a regression. |
| 235 | 230 |
| 236 var allEventInterfacesCreateEvents = true; | 231 var allEventInterfacesCreateEvents = true; |
| 237 for (var propertyName in window) { | 232 for (var propertyName in window) { |
| 238 if (propertyName.match(/Event$/) && window[propertyName].toString().matc
h(/EventConstructor\]$/)) { | 233 if (propertyName.match(/Event$/) && window[propertyName].toString().matc
h(/EventConstructor\]$/)) { |
| 239 try { | 234 try { |
| 240 if (!(document.createEvent(propertyName) instanceof window.Event
)) { | 235 if (!(document.createEvent(propertyName) instanceof window.Event
)) { |
| 241 allEventInterfacesCreateEvents = false; | 236 allEventInterfacesCreateEvents = false; |
| 242 debug("'document.createEvent(propertyName) instanceof window
.Event' with propertyName: " + propertyName + " should be true but isn't"); | 237 debug("'document.createEvent(propertyName) instanceof window
.Event' with propertyName: " + propertyName + " should be true but isn't"); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 266 debug("'document.createEvent(propertyName).constructor === windo
w[propertyName]' with propertyName: " + propertyName + " threw an exception: " +
e); | 261 debug("'document.createEvent(propertyName).constructor === windo
w[propertyName]' with propertyName: " + propertyName + " threw an exception: " +
e); |
| 267 } | 262 } |
| 268 } | 263 } |
| 269 } | 264 } |
| 270 shouldBeTrue('allEventInterfacesCreateEvents'); | 265 shouldBeTrue('allEventInterfacesCreateEvents'); |
| 271 </script> | 266 </script> |
| 272 | 267 |
| 273 | 268 |
| 274 | 269 |
| 275 </body> | 270 </body> |
| OLD | NEW |