Availability: |
| ||||
JavaScript syntax: | N | myEventException = new EventException() | |||
Object properties: | code | ||||
Class constants: | UNSPECIFIED_EVENT_TYPE_ERR |
During the processing of an event with its handler, some unexpected circumstance may cause an exception to occur. This is not quite the same as a try ... catch exception as defined in ECMAScript.
DOM level 2 describes an EventException object, but it's not obvious how this would be associated with any JavaScript function that could be set up to catch it. The DOM level 2 event specification is founded on the principle that the implementation should be at least ECMAScript (third edition) compliant. This should ensure it has sophisticated enough error handling support to cope with an exception being thrown. Neither specification describes in detail exactly how this should happen and so it is likely that, whilst we may have browsers that support a standard and consistent object model, we still have portability problems because they implement the surrounding infrastructure differently.
Assuming that a function handler were called, it would be passed a reference to an EventException object from which it could obtain a code value that describes the cause of the exception. Perhaps, the onError handler may be used to trap this but an implementation might choose to provide an onException handler.
At DOM level 2, only the UNSPECIFIED_EVENT_TYPE_ERR is defined as a static constant. This has the value 0. Other event types may be defined in later versions of the DOM specification.
See also: | EventTarget.dispatchEvent() |
Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
code | 1.5 ![]() | ![]() | 6.0 ![]() | ![]() | ![]() | ![]() | ![]() | 2 ![]() | ![]() | ![]() | - |
Prev | Home | Next |
EventCapturer object | Up | EventException.code |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |