Re: [IndexedDB] IDBEvent and Event

On Sat, Jun 26, 2010 at 12:41 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Fri, Jun 25, 2010 at 2:20 PM, Shawn Wilsher <sdwilsh@mozilla.com> wrote:
>> Hey all,
>>
>> I think that IDBEvent needs to inherit from Event [1] in order for us to
>> properly inherit from EventTarget in IDBRequest.  Specifically, EventTarget
>> takes an EventListener [2] which has a method, handleEvent, that takes an
>> Event object.  I'm not sure this makes sense for us though, so I figured I'd
>> start a discussion before filing the bug.
>>
>> Cheers,
>>
>> Shawn
>>
>> [1] http://www.w3.org/TR/DOM-Level-3-Events/#interface-Event
>> [2] http://www.w3.org/TR/DOM-Level-3-Events/#interface-EventListener
>
> Technically I don't think inheriting from Event is required. You can
> generally always use language specific means of casting between
> interfaces. This is how for example Document [1] and DocumentTraversal
> [2] are related. I.e. even though you receive an Event object in
> handleEvent, you can always cast that to IDBEvent using whatever
> casting mechanism your language have.
>
> However if we want to follow the pattern used everywhere else for
> events [3], and I definitely think we do, then IDBEvent should indeed
> inherit from Event.
>

Agreed. In WebKit, Jeremy already made it inherit from Event.

http://trac.webkit.org/browser/trunk/WebCore/storage/IDBEvent.idl#L33

Thanks,
Andrei

Received on Wednesday, 30 June 2010 15:26:00 UTC