W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

[indexeddb] Updates to the Event Constructor to match DOM 4

From: Israel Hilerio <israelh@microsoft.com>
Date: Wed, 21 Sep 2011 18:58:22 +0000
To: "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <F695AF7AA77CC745A271AD0F61BBC61E3D26FB95@TK5EX14MBXC119.redmond.corp.microsoft.com>

This is our interpretation of how we see incorporating the new Event constructor model defined in DOM 4.

[Constructor(DOMString type, optional IDBVersionChangeEventInit IDBVersionChangeEventInitDict)]
interface IDBVersionChangeEvent : Event {
    readonly attribute DOMString oldVersion;
    readonly attribute DOMString newVersion;
    void initIDBVersionChangeEvent (DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, DOMString oldVersion, DOMString newVersion);

dictionary IDBVersionChangeEventInit : EventInit {
   DOMString oldVersion;
   DOMString newVersion;

We'll need to add a step between 3 and 4 to section 4.12 and a note:
3.5 After dispatching the event, if the event was not cancelled and allowed to bubble, then dispatch an ErrorEvent with the type set to "error" to the Window.
NOTE: When constructing an IDBVersionChangeEvent you need to follow the same steps defined in DOM4 Section 4.3 Constructing events.  In addition, setting the onerror event handler with window.addEventListener will return the ErrorEvent.  However, setting the onerror event handler with window.onerror will return three arguments as specified in HTML5 spec: event, source, and lineno [1].

Sample code on how to use the event constructor:
var myDictionary = { canBubble: true, cancellable: true, oldVersion=1, newVersion=2};
var changeEvent = new IDBVersionChangeEvent("versionchange", myDictionary);

Let us know if this is what you're thinking.

[1] http://dev.w3.org/html5/spec/Overview.html#event-handler-attributes
Received on Wednesday, 21 September 2011 18:58:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:24 UTC